-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add subPath to WorkspacePipelineTaskBinding
Use case: Use two instances of a task that writes to the same workspace volume - but they write to different path of the volume. A typical use case is two git-clone tasks that clone two git repositories, but the files should be located in two different directories on the workspace volume. This commit solves this by adding the `subPath` field to the WorkspacePipelineTaskBinding. In addition, it forbids the `subPath` field in the PipelineRun/TaskRun when using `volumeClaimTemplate`. It also validates the workspaceBinding on `PipelineRun` to check that the subPath field is not used on a volumeClaimTemplate workspace binding - it should instead be set when binding the workspace in the PipelineTask.
- Loading branch information
1 parent
35d5121
commit 30ee0ed
Showing
11 changed files
with
206 additions
and
8 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
examples/v1beta1/pipelineruns/pipelinerun-using-different-subpaths-of-workspace.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: writer | ||
spec: | ||
steps: | ||
- name: write | ||
image: ubuntu | ||
script: echo bar > $(workspaces.task-ws.path)/foo | ||
workspaces: | ||
- name: task-ws | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: pipeline-using-different-subpaths | ||
spec: | ||
tasks: | ||
- name: writer-1 | ||
taskRef: | ||
name: writer | ||
workspaces: | ||
- name: task-ws | ||
workspace: ws | ||
subPath: dir-1 | ||
- name: writer-2 | ||
taskRef: | ||
name: writer | ||
workspaces: | ||
- name: task-ws | ||
workspace: ws | ||
subPath: dir-2 | ||
- name: read-all | ||
runAfter: | ||
- writer-1 | ||
- writer-2 | ||
taskSpec: | ||
steps: | ||
- name: read-1 | ||
image: ubuntu | ||
script: cat $(workspaces.local-ws.path)/dir-1/foo | grep bar | ||
- name: read-2 | ||
image: ubuntu | ||
script: cat $(workspaces.local-ws.path)/dir-2/foo | grep bar | ||
workspaces: | ||
- name: local-ws | ||
workspaces: | ||
- name: local-ws | ||
workspace: ws | ||
workspaces: | ||
- name: ws | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: pr- | ||
spec: | ||
pipelineRef: | ||
name: pipeline-using-different-subpaths | ||
workspaces: | ||
- name: ws | ||
volumeClaimTemplate: | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi |
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
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
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
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
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
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
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
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
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
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