-
-
Save skaegi/284ed462fcdd9cf39671731f8bb44e5a to your computer and use it in GitHub Desktop.
Example using generated workspace subpaths and interpolation to retrieve the value, absolute paths in the Tasks, two separate workspaces instead of the hierarchical mailbox workspace
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: Task | |
metadata: | |
name: make-stuff | |
spec: | |
params: | |
- name: message | |
steps: | |
- name: doit | |
image: alpine | |
command: ["/bin/sh", "-c"] | |
args: | |
- echo $(params.message) > /workspaces/messages/message; | |
workspaces: | |
- name: messages | |
description: the folder where we write the message to | |
--- | |
apiVersion: tekton.dev/v1alpha1 | |
kind: Task | |
metadata: | |
name: read-messages | |
spec: | |
steps: | |
- name: doit | |
image: alpine | |
script: | | |
#!/usr/bin/env bash | |
cat /workspaces/hello-mailbox/message | |
cat /workspaces/world-mailbox/message | |
workspaces: | |
- name: hello-mailbox | |
description: the folder containing the hello message | |
- name: world-mailbox | |
description: the folder containing the world message | |
--- | |
apiVersion: tekton.dev/v1alpha1 | |
kind: Pipeline | |
metadata: | |
name: volumes-forevah | |
spec: | |
volumes: | |
- name: the-volume | |
description: the volume to put everything on | |
tasks: | |
- name: write-hello | |
taskRef: | |
name: make-stuff | |
inputs: | |
params: | |
- name: message | |
value: hello | |
workspaces: | |
- name: messages | |
volume: the-volume | |
- name: write-world | |
taskRef: | |
name: make-stuff-world | |
inputs: | |
params: | |
- name: message | |
value: world | |
workspaces: | |
name: messages | |
volume: the-volume | |
- name: read-it-all | |
taskRef: | |
name: read-messages | |
workspaces: | |
- name: hello-mailbox | |
volume: the-volume | |
subPath: $(tasks.write-hello.workspaces.messages.subPath) | |
- name: world-mailbox | |
volume: the-volume | |
subPath: $(tasks.write-world.workspaces.messages.subPath) | |
--- | |
apiVersion: tekton.dev/v1alpha1 | |
kind: PipelineRun | |
metadata: | |
name: volumes-forevah-run | |
spec: | |
pipelineRef: | |
name: volumes-forevah | |
volumes: | |
- name: the-volume | |
persistentVolumeClaim: | |
- name: my-pvc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment