-
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.
TEP-0111 - Propagating workspaces in Taskrun
This POC illustrates propagating workspaces defined at the `pipelinerun` stage and directly referred at the `spec`. There is no need to specify it in the `pipelinespec` followed by `tasks` and `taskspec`.
- Loading branch information
1 parent
11e5c37
commit 13ef6d8
Showing
15 changed files
with
512 additions
and
91 deletions.
There are no files selected for viewing
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
16 changes: 16 additions & 0 deletions
16
examples/v1beta1/taskruns/alpha/propagating_workspaces.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,16 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: TaskRun | ||
metadata: | ||
generateName: propagating-workspaces- | ||
spec: | ||
taskSpec: | ||
steps: | ||
- name: simple-step | ||
image: ubuntu | ||
command: | ||
- echo | ||
args: | ||
- $(workspaces.tr-workspace.path) | ||
workspaces: | ||
- emptyDir: {} | ||
name: tr-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
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,75 @@ | ||
/* | ||
Copyright 2019 The Tekton Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" | ||
"github.com/tektoncd/pipeline/test/diff" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
) | ||
|
||
func TestTaskSpec_FindWorkspaceSubstitutionLocationsInTask(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
ts *v1.TaskSpec | ||
want sets.String | ||
}{{ | ||
name: "completespec", | ||
ts: &v1.TaskSpec{ | ||
Steps: []v1.Step{{ | ||
Name: "step-name", | ||
Image: "step-image", | ||
Script: "step-script", | ||
Command: []string{"step-command"}, | ||
Args: []string{"step-args"}, | ||
}}, | ||
Sidecars: []v1.Sidecar{{ | ||
Name: "sidecar-name", | ||
Image: "sidecar-image", | ||
Script: "sidecar-script", | ||
Command: []string{"sidecar-command"}, | ||
Args: []string{"sidecar-args"}, | ||
}}, | ||
StepTemplate: &v1.StepTemplate{ | ||
Image: "steptemplate-image", | ||
Command: []string{"steptemplate-command"}, | ||
Args: []string{"steptemplate-args"}, | ||
}, | ||
}, | ||
want: sets.NewString( | ||
"step-script", | ||
"step-args", | ||
"step-command", | ||
"sidecar-script", | ||
"sidecar-args", | ||
"sidecar-command", | ||
"steptemplate-args", | ||
"steptemplate-command", | ||
), | ||
}} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := tt.ts.FindWorkspaceSubstitutionLocationsInTask() | ||
if d := cmp.Diff(tt.want, got); d != "" { | ||
t.Error(diff.PrintWantGot(d)) | ||
} | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.