diff --git a/pkg/apis/pipeline/v1alpha1/merge_test.go b/pkg/apis/pipeline/v1alpha1/merge_test.go index 5b159f548d1..fecccd86dec 100644 --- a/pkg/apis/pipeline/v1alpha1/merge_test.go +++ b/pkg/apis/pipeline/v1alpha1/merge_test.go @@ -100,6 +100,28 @@ func TestMergeStepsWithStepTemplate(t *testing.T) { Value: "NEW_VALUE", }}, }}}, + }, { + name: "merge-preserves-script", + template: &corev1.Container{ + Env: []corev1.EnvVar{{ + Name: "FOO", + Value: "bar", + }}, + }, + steps: []Step{{ + Script: "my-script", + Container: corev1.Container{Image: "image"}, + }}, + expected: []Step{{ + Script: "my-script", + Container: corev1.Container{ + Image: "image", + Env: []corev1.EnvVar{{ + Name: "FOO", + Value: "bar", + }}, + }, + }}, }} { t.Run(tc.name, func(t *testing.T) { result, err := MergeStepsWithStepTemplate(tc.template, tc.steps) diff --git a/pkg/pod/script_test.go b/pkg/pod/script_test.go index 8d4cb8b4d9b..c5d7fcb2e97 100644 --- a/pkg/pod/script_test.go +++ b/pkg/pod/script_test.go @@ -66,6 +66,7 @@ func TestConvertScripts(t *testing.T) { Container: corev1.Container{ Image: "step-3", VolumeMounts: preExistingVolumeMounts, + Args: []string{"my", "args"}, }, }}) wantInit := &corev1.Container{ @@ -95,6 +96,7 @@ script-heredoc-randomly-generated-6nl7g }, { Image: "step-3", Command: []string{"/tekton/scripts/script-2-78c5n"}, + Args: []string{"my", "args"}, VolumeMounts: append(preExistingVolumeMounts, scriptsVolumeMount), }} if d := cmp.Diff(wantInit, gotInit); d != "" {