Skip to content

Commit 779af13

Browse files
committed
Make sure we skip clustertasks
Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent c020bdb commit 779af13

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

pkg/resolve/resolve.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ func inlineTasks(tasks []tektonv1beta1.PipelineTask, ropt *Opts, types Types) ([
8181
error) {
8282
pipelineTasks := []tektonv1beta1.PipelineTask{}
8383
for _, task := range tasks {
84-
if task.TaskRef != nil && task.TaskRef.Bundle == "" && !skippingTask(task.TaskRef.Name, ropt.SkipInlining) {
84+
if task.TaskRef != nil && task.TaskRef.Bundle == "" &&
85+
string(task.TaskRef.Kind) != "ClusterTask" &&
86+
!skippingTask(task.TaskRef.Name, ropt.SkipInlining) {
8587
taskResolved, err := getTaskByName(task.TaskRef.Name, types.Tasks)
8688
if err != nil {
8789
return nil, err

pkg/resolve/resolve_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ func TestBundlesSkipped(t *testing.T) {
8585
assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskRef.Bundle, "reg.io/ruben/barichello@sha256:1234")
8686
}
8787

88+
func TestClusterTasksSkipped(t *testing.T) {
89+
resolved, _, err := readTDfile(t, "pipelinerun-with-a-clustertasks", false)
90+
assert.NilError(t, err)
91+
assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].Name, "clustertask")
92+
assert.Equal(t, string(resolved.Spec.PipelineSpec.Tasks[0].TaskRef.Kind), "ClusterTask")
93+
}
94+
8895
func TestPipelineRunPipelineSpecTaskSpec(t *testing.T) {
8996
resolved, _, err := readTDfile(t, "pipelinerun-pipelinespec-taskspec", false)
9097
assert.NilError(t, err)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
apiVersion: tekton.dev/v1beta1
3+
kind: PipelineRun
4+
metadata:
5+
name: pr-test1
6+
spec:
7+
pipelineRef:
8+
name: pipeline-test1
9+
params:
10+
- name: key
11+
value: "{{value}}"
12+
---
13+
apiVersion: tekton.dev/v1beta1
14+
kind: Pipeline
15+
metadata:
16+
name: pipeline-test1
17+
spec:
18+
params:
19+
- name: repo_url
20+
- name: revision
21+
tasks:
22+
- name: clustertask
23+
taskRef:
24+
name: foo
25+
kind: ClusterTask
26+
steps:
27+
- name: first-step
28+
image: image

0 commit comments

Comments
 (0)