Last active
February 9, 2023 22:00
-
-
Save pritidesai/3f58fc1193d07e4f256bef54cd946310 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: v1 | |
kind: PersistentVolume | |
metadata: | |
name: task-pv-volume | |
labels: | |
type: local | |
spec: | |
storageClassName: manual | |
capacity: | |
storage: 16Mi | |
accessModes: | |
- ReadWriteOnce | |
hostPath: | |
path: "/mnt/data" | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: shared-task-storage | |
spec: | |
storageClassName: manual | |
resources: | |
requests: | |
storage: 16Mi | |
accessModes: | |
- ReadWriteOnce | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: write-data | |
spec: | |
workspaces: | |
- name: storage | |
mountPath: /mnt/data | |
steps: | |
- name: write-data | |
image: bash:latest | |
script: | | |
#!/usr/bin/env bash | |
echo -n "hello" | tee $(workspaces.storage.path)/hello.txt | |
echo -e "\n" | |
echo $(workspaces.storage.path) | |
echo -e "\n" | |
ls $(workspaces.storage.path) | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: read-data | |
spec: | |
workspaces: | |
- name: storage | |
mountPath: /mnt/data | |
steps: | |
- name: read-data | |
image: bash:latest | |
script: | | |
#!/usr/bin/env bash | |
cat $(workspaces.storage.path)/hello.txt | |
echo -e "\n" | |
echo $(workspaces.storage.path) | |
echo -e "\n" | |
ls $(workspaces.storage.path) | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: pipeline-with-subpath | |
spec: | |
workspaces: | |
- name: shared-data | |
tasks: | |
- name: write-data | |
taskRef: | |
name: write-data | |
workspaces: | |
- name: storage | |
workspace: shared-data | |
- name: read-data | |
taskRef: | |
name: read-data | |
runAfter: | |
- write-data | |
workspaces: | |
- name: storage | |
workspace: shared-data | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: PipelineRun | |
metadata: | |
generateName: pipelinerun-with-subpath- | |
spec: | |
pipelineRef: | |
name: pipeline-with-subpath | |
workspaces: | |
- name: shared-data | |
subPath: data | |
persistentVolumeClaim: | |
claimName: shared-task-storage | |
--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment