Last active
April 25, 2020 13:43
-
-
Save praveen4g0/e6da1b32227f9dcc24283dba4e948259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: tekton.dev/v1alpha1 | |
kind: PipelineResource | |
metadata: | |
name: skaffold-git-output-pipelinerun | |
spec: | |
type: git | |
params: | |
- name: revision | |
value: v0.32.0 | |
- name: url | |
value: https://github.com/GoogleContainerTools/skaffold | |
--- | |
# Task writes "some stuff" to a predefined path in the workspace git PipelineResource | |
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: create-file | |
spec: | |
resources: | |
inputs: | |
- name: workspace | |
type: git | |
targetPath: damnworkspace | |
outputs: | |
- name: workspace | |
type: git | |
steps: | |
- name: read-docs-old | |
image: ubuntu | |
command: ["/bin/bash"] | |
args: ['-c', 'ls -la /workspace/damnworkspace/docs/README.md'] # tests that targetpath works | |
- name: write-new-stuff | |
image: ubuntu | |
command: ['bash'] | |
args: ['-c', 'ln -s /workspace/damnworkspace /workspace/output/workspace && echo some stuff > /workspace/output/workspace/stuff'] | |
--- | |
# Reads a file from a predefined path in the workspace git PipelineResource | |
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: check-stuff-file-exists | |
spec: | |
params: | |
- name: args | |
type: array | |
resources: | |
inputs: | |
- name: workspace | |
type: git | |
targetPath: newworkspace | |
steps: | |
- name: read | |
image: ubuntu | |
command: ["/bin/bash"] | |
args: ['$(inputs.params.args[*])'] # tests that new targetpath and previous task output is dumped | |
--- | |
# The Output of the first Task (git resource) create-file is given as an `Input` | |
# to the next `Task` check-stuff-file-exists using`from` clause. | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: output-pipeline | |
spec: | |
resources: | |
- name: source-repo | |
type: git | |
tasks: | |
- name: first-create-file # 1. create file | |
taskRef: | |
name: create-file | |
timeout: 10m | |
resources: | |
inputs: | |
- name: workspace | |
resource: source-repo | |
outputs: | |
- name: workspace | |
resource: source-repo | |
- name: then-check # 2. check file exists | |
taskRef: | |
name: check-stuff-file-exists | |
timeout: 10m | |
params: | |
- name: args | |
value: | |
- '-c' | |
- 'cat /workspace/newworkspace/stuff' | |
resources: | |
inputs: | |
- name: workspace | |
resource: source-repo | |
from: [first-create-file] | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: PipelineRun | |
metadata: | |
name: output-pipeline-run | |
spec: | |
pipelineRef: | |
name: output-pipeline | |
resources: | |
- name: source-repo | |
resourceRef: | |
name: skaffold-git-output-pipelinerun |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment