diff --git a/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go b/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go index 828739c7494..1e0853c1115 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go +++ b/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go @@ -52,12 +52,6 @@ type PipelineRunSpec struct { Params []Param `json:"params,omitempty"` // +optional ServiceAccountName string `json:"serviceAccountName,omitempty"` - // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. - // Deprecated: Use serviceAccountName instead. - // +optional - DeprecatedServiceAccount string `json:"serviceAccount,omitempty"` - // +optional - DeprecatedServiceAccounts []DeprecatedPipelineRunSpecServiceAccount `json:"serviceAccounts,omitempty"` // +optional ServiceAccountNames []PipelineRunSpecServiceAccountName `json:"serviceAccountNames,omitempty"` // Used for cancelling a pipelinerun (and maybe more later on) @@ -156,16 +150,6 @@ func (pr *PipelineRunStatus) InitializeConditions() { pipelineRunCondSet.Manage(pr).InitializeConditions() } -// DeprecatedPipelineRunSpecServiceAccount can be used to configure specific -// ServiceAccount for a concrete Task -// Deprecated: Use pipelineRunSpecServiceAccountName instead. -type DeprecatedPipelineRunSpecServiceAccount struct { - TaskName string `json:"taskName,omitempty"` - // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. - // Deprecated: Use serviceAccountName instead. - DeprecatedServiceAccount string `json:"serviceAccount,omitempty"` -} - // PipelineRunSpecServiceAccountName can be used to configure specific // ServiceAccountName for a concrete Task type PipelineRunSpecServiceAccountName struct { @@ -279,14 +263,6 @@ func (pr *PipelineRun) IsTimedOut() bool { // PipelineTask if configured, otherwise it returns the PipelineRun's serviceAccountName. func (pr *PipelineRun) GetServiceAccountName(pipelineTaskName string) string { serviceAccountName := pr.Spec.ServiceAccountName - if serviceAccountName == "" { - serviceAccountName = pr.Spec.DeprecatedServiceAccount - } - for _, sa := range pr.Spec.DeprecatedServiceAccounts { - if sa.TaskName == pipelineTaskName { - serviceAccountName = sa.DeprecatedServiceAccount - } - } for _, sa := range pr.Spec.ServiceAccountNames { if sa.TaskName == pipelineTaskName { serviceAccountName = sa.ServiceAccountName diff --git a/pkg/apis/pipeline/v1alpha1/pipelinerun_types_test.go b/pkg/apis/pipeline/v1alpha1/pipelinerun_types_test.go index 737b33a1e21..32d5d51d4a1 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelinerun_types_test.go +++ b/pkg/apis/pipeline/v1alpha1/pipelinerun_types_test.go @@ -235,31 +235,18 @@ func TestPipelineRunGetServiceAccountName(t *testing.T) { "taskName": "taskSA", }, }, - { - "deprecated default SA", - tb.PipelineRun("pr", "ns", - tb.PipelineRunSpec("prs", - tb.PipelineRunDeprecatedServiceAccountName("", "deprecatedSA"), - tb.PipelineRunDeprecatedServiceAccountTask("taskName", "deprecatedTaskSA"))), - map[string]string{ - "unknown": "deprecatedSA", - "taskName": "deprecatedTaskSA", - }, - }, { "mixed default SA", tb.PipelineRun("defaultSA", "defaultSA", tb.PipelineRunSpec("defaultSA", - tb.PipelineRunDeprecatedServiceAccountName("defaultSA", "deprecatedSA"), + tb.PipelineRunServiceAccountName("defaultSA"), tb.PipelineRunServiceAccountNameTask("task1", "task1SA"), tb.PipelineRunServiceAccountNameTask("task2", "task2SA"), - tb.PipelineRunDeprecatedServiceAccountTask("deprecatedTask3", "deprecatedTask3SA"), - tb.PipelineRunDeprecatedServiceAccountTask("task2", "deprecated"))), + )), map[string]string{ - "unknown": "defaultSA", - "task1": "task1SA", - "task2": "task2SA", - "deprecatedTask3": "deprecatedTask3SA", + "unknown": "defaultSA", + "task1": "task1SA", + "task2": "task2SA", }, }, } { diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_types.go b/pkg/apis/pipeline/v1alpha1/taskrun_types.go index ab13a64cd4f..1a676a7cbaf 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_types.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_types.go @@ -35,10 +35,6 @@ type TaskRunSpec struct { Outputs TaskRunOutputs `json:"outputs,omitempty"` // +optional ServiceAccountName string `json:"serviceAccountName"` - // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. - // Deprecated: Use serviceAccountName instead. - // +optional - DeprecatedServiceAccount string `json:"serviceAccount,omitempty"` // no more than one of the TaskRef and TaskSpec may be specified. // +optional TaskRef *TaskRef `json:"taskRef,omitempty"` @@ -291,15 +287,6 @@ func (tr *TaskRun) GetRunKey() string { return fmt.Sprintf("%s/%p", "TaskRun", tr) } -func (tr *TaskRun) GetServiceAccountName() string { - name := tr.Spec.ServiceAccountName - if name == "" { - name = tr.Spec.DeprecatedServiceAccount - } - return name - -} - // IsPartOfPipeline return true if TaskRun is a part of a Pipeline. // It also return the name of Pipeline and PipelineRun func (tr *TaskRun) IsPartOfPipeline() (bool, string, string) { diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_types_test.go b/pkg/apis/pipeline/v1alpha1/taskrun_types_test.go index 9e1b8a95a24..aea8d19b104 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_types_test.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_types_test.go @@ -153,33 +153,6 @@ func TestTaskRunHasStarted(t *testing.T) { } } -func TestTaskRunGetServiceAccountName(t *testing.T) { - for _, tt := range []struct { - name string - tr *v1alpha1.TaskRun - expectedSA string - }{{ - "service account", - tb.TaskRun("name", "ns", tb.TaskRunSpec(tb.TaskRunServiceAccountName("defaultSA"))), - "defaultSA", - }, - { - "deprecated SA", - tb.TaskRun("name", "ns", tb.TaskRunSpec(tb.TaskRunDeprecatedServiceAccount("", "deprecatedSA"))), - "deprecatedSA", - }, - { - "both SA", - tb.TaskRun("name", "ns", tb.TaskRunSpec(tb.TaskRunDeprecatedServiceAccount("defaultSA", "deprecatedSA"))), - "defaultSA", - }, - } { - if e, a := tt.expectedSA, tt.tr.GetServiceAccountName(); e != a { - t.Errorf("%s: wrong service account name: got: %q want: %q", tt.name, a, e) - } - } -} - func TestTaskRunIsOfPipelinerun(t *testing.T) { tests := []struct { name string diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index 6148013aeaf..2d57103828e 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -379,22 +379,6 @@ func (in *ConditionSpec) DeepCopy() *ConditionSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DeprecatedPipelineRunSpecServiceAccount) DeepCopyInto(out *DeprecatedPipelineRunSpecServiceAccount) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeprecatedPipelineRunSpecServiceAccount. -func (in *DeprecatedPipelineRunSpecServiceAccount) DeepCopy() *DeprecatedPipelineRunSpecServiceAccount { - if in == nil { - return nil - } - out := new(DeprecatedPipelineRunSpecServiceAccount) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GCSResource) DeepCopyInto(out *GCSResource) { *out = *in @@ -957,11 +941,6 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.DeprecatedServiceAccounts != nil { - in, out := &in.DeprecatedServiceAccounts, &out.DeprecatedServiceAccounts - *out = make([]DeprecatedPipelineRunSpecServiceAccount, len(*in)) - copy(*out, *in) - } if in.ServiceAccountNames != nil { in, out := &in.ServiceAccountNames, &out.ServiceAccountNames *out = make([]PipelineRunSpecServiceAccountName, len(*in)) diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index 374936192c2..026db64ddc5 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -1073,138 +1073,6 @@ func TestReconcileWithDifferentServiceAccounts(t *testing.T) { } -func TestReconcileWithDeprecatedServiceAccounts(t *testing.T) { - names.TestingSeed() - - ps := []*v1alpha1.Pipeline{ - tb.Pipeline("test-sa-0", "foo", tb.PipelineSpec(tb.PipelineTask("deprecated-sa-0", "hello-world-task"))), - tb.Pipeline("test-sa-1", "foo", tb.PipelineSpec(tb.PipelineTask("sa-1", "hello-world-task"))), - tb.Pipeline("test-sa-2", "foo", tb.PipelineSpec(tb.PipelineTask("task-deprecated-sa-2", "hello-world-task"))), - tb.Pipeline("test-sa-3", "foo", tb.PipelineSpec(tb.PipelineTask("task-sa-3", "hello-world-task"))), - } - prs := []*v1alpha1.PipelineRun{ - tb.PipelineRun("test-pipeline-run-deprecated-sa-0", "foo", - tb.PipelineRunSpec("test-sa-0", - tb.PipelineRunDeprecatedServiceAccountName("", "sa-0"), - ), - ), - tb.PipelineRun("test-pipeline-run-sa-1", "foo", - tb.PipelineRunSpec("test-sa-1", - tb.PipelineRunDeprecatedServiceAccountName("sa-1", "sa-0"), - ), - ), - tb.PipelineRun("test-pipeline-run-task-deprecated-sa-2", "foo", - tb.PipelineRunSpec("test-sa-2", - tb.PipelineRunServiceAccountName("wrong-sa"), - tb.PipelineRunDeprecatedServiceAccountTask("task-deprecated-sa-2", "sa-2"), - ), - ), - tb.PipelineRun("test-pipeline-run-task-sa-3", "foo", - tb.PipelineRunSpec("test-sa-3", - tb.PipelineRunServiceAccountName("wrong-sa"), - tb.PipelineRunServiceAccountNameTask("task-sa-3", "sa-3"), - tb.PipelineRunDeprecatedServiceAccountTask("task-sa-3", "wrong-deprecated-sa"), - ), - ), - } - - ts := []*v1alpha1.Task{ - tb.Task("hello-world-task", "foo"), - } - - d := test.Data{ - PipelineRuns: prs, - Pipelines: ps, - Tasks: ts, - } - - testAssets, cancel := getPipelineRunController(t, d) - defer cancel() - c := testAssets.Controller - clients := testAssets.Clients - - for _, pr := range prs { - err := c.Reconciler.Reconcile(context.Background(), fmt.Sprintf("%s/%s", pr.GetNamespace(), pr.GetName())) - if err != nil { - t.Errorf("Did not expect to see error when reconciling completed PipelineRun but saw %s", err) - } - - // Check that the PipelineRun was reconciled correctly - _, err = clients.Pipeline.Tekton().PipelineRuns(pr.GetNamespace()).Get(pr.GetName(), metav1.GetOptions{}) - if err != nil { - t.Fatalf("Somehow had error getting completed reconciled run out of fake client: %s", err) - } - } - - expectedTaskRuns := []*v1alpha1.TaskRun{ - tb.TaskRun("test-pipeline-run-deprecated-sa-0-deprecated-sa-0-9l9zj", "foo", - tb.TaskRunOwnerReference("PipelineRun", "test-pipeline-run-deprecated-sa-0", - tb.OwnerReferenceAPIVersion("tekton.dev/v1alpha1"), - tb.Controller, tb.BlockOwnerDeletion, - ), - tb.TaskRunSpec( - tb.TaskRunTaskRef("hello-world-task"), - tb.TaskRunServiceAccountName("sa-0"), - ), - tb.TaskRunLabel("tekton.dev/pipeline", "test-sa-0"), - tb.TaskRunLabel("tekton.dev/pipelineRun", "test-pipeline-run-deprecated-sa-0"), - tb.TaskRunLabel("tekton.dev/pipelineTask", "deprecated-sa-0"), - ), - tb.TaskRun("test-pipeline-run-sa-1-sa-1-mz4c7", "foo", - tb.TaskRunOwnerReference("PipelineRun", "test-pipeline-run-sa-1", - tb.OwnerReferenceAPIVersion("tekton.dev/v1alpha1"), - tb.Controller, tb.BlockOwnerDeletion, - ), - tb.TaskRunSpec( - tb.TaskRunTaskRef("hello-world-task"), - tb.TaskRunServiceAccountName("sa-1"), - ), - tb.TaskRunLabel("tekton.dev/pipeline", "test-sa-1"), - tb.TaskRunLabel("tekton.dev/pipelineRun", "test-pipeline-run-sa-1"), - tb.TaskRunLabel("tekton.dev/pipelineTask", "sa-1"), - ), - tb.TaskRun("test-pipeline-run-task-deprecated-sa-2-task-deprecated-sa-mssqb", "foo", - tb.TaskRunOwnerReference("PipelineRun", "test-pipeline-run-task-deprecated-sa-2", - tb.OwnerReferenceAPIVersion("tekton.dev/v1alpha1"), - tb.Controller, tb.BlockOwnerDeletion, - ), - tb.TaskRunSpec( - tb.TaskRunTaskRef("hello-world-task"), - tb.TaskRunServiceAccountName("sa-2"), - ), - tb.TaskRunLabel("tekton.dev/pipeline", "test-sa-2"), - tb.TaskRunLabel("tekton.dev/pipelineRun", "test-pipeline-run-task-deprecated-sa-2"), - tb.TaskRunLabel("tekton.dev/pipelineTask", "task-deprecated-sa-2"), - ), - tb.TaskRun("test-pipeline-run-task-sa-3-task-sa-3-78c5n", "foo", - tb.TaskRunOwnerReference("PipelineRun", "test-pipeline-run-task-sa-3", - tb.OwnerReferenceAPIVersion("tekton.dev/v1alpha1"), - tb.Controller, tb.BlockOwnerDeletion, - ), - tb.TaskRunSpec( - tb.TaskRunTaskRef("hello-world-task"), - tb.TaskRunServiceAccountName("sa-3"), - ), - tb.TaskRunLabel("tekton.dev/pipeline", "test-sa-3"), - tb.TaskRunLabel("tekton.dev/pipelineRun", "test-pipeline-run-task-sa-3"), - tb.TaskRunLabel("tekton.dev/pipelineTask", "task-sa-3"), - ), - } - - for _, taskRun := range expectedTaskRuns { - // Check that the expected TaskRun was created - actual, err := clients.Pipeline.Tekton().TaskRuns(taskRun.GetNamespace()).Get(taskRun.GetName(), metav1.GetOptions{}) - if err != nil { - t.Fatalf("Expected a TaskRun to be created, but it wasn't: %s", err) - } - if d := cmp.Diff(actual, taskRun); d != "" { - t.Errorf("expected to see TaskRun %v created. Diff %s", taskRun, d) - } - - } - -} - func TestReconcileWithTimeoutAndRetry(t *testing.T) { tcs := []struct { diff --git a/pkg/reconciler/taskrun/entrypoint/entrypoint.go b/pkg/reconciler/taskrun/entrypoint/entrypoint.go index afe21890e0d..73d5431393e 100644 --- a/pkg/reconciler/taskrun/entrypoint/entrypoint.go +++ b/pkg/reconciler/taskrun/entrypoint/entrypoint.go @@ -232,7 +232,7 @@ func getRemoteImage(image string, kubeclient kubernetes.Interface, taskRun *v1al kc, err := k8schain.New(kubeclient, k8schain.Options{ Namespace: taskRun.Namespace, - ServiceAccountName: taskRun.GetServiceAccountName(), + ServiceAccountName: taskRun.Spec.ServiceAccountName, }) if err != nil { return nil, xerrors.Errorf("Failed to create k8schain: %w", err) diff --git a/pkg/reconciler/taskrun/entrypoint/entrypoint_test.go b/pkg/reconciler/taskrun/entrypoint/entrypoint_test.go index 9f122d2b48f..0b3cd2c2fa9 100644 --- a/pkg/reconciler/taskrun/entrypoint/entrypoint_test.go +++ b/pkg/reconciler/taskrun/entrypoint/entrypoint_test.go @@ -401,8 +401,7 @@ func TestGetRemoteEntrypointWithNonDefaultSA(t *testing.T) { for _, tt := range []func(taskRun *v1alpha1.TaskRun) *v1alpha1.TaskRun{ func(tr *v1alpha1.TaskRun) *v1alpha1.TaskRun { return tr }, func(tr *v1alpha1.TaskRun) *v1alpha1.TaskRun { - tr.Spec.ServiceAccountName = "" - tr.Spec.DeprecatedServiceAccount = "some-other-sa" + tr.Spec.ServiceAccountName = "some-other-sa" return tr }, } { diff --git a/pkg/reconciler/taskrun/resources/pod.go b/pkg/reconciler/taskrun/resources/pod.go index ea91c07b40a..dae177ff744 100644 --- a/pkg/reconciler/taskrun/resources/pod.go +++ b/pkg/reconciler/taskrun/resources/pod.go @@ -113,7 +113,7 @@ func MakePod(images pipeline.Images, taskRun *v1alpha1.TaskRun, taskSpec v1alpha var initContainers []corev1.Container var volumes []corev1.Volume - if credsInitContainer, secretsVolumes, err := pod.CredsInit(images.CredsImage, taskRun.GetServiceAccountName(), taskRun.Namespace, kubeclient, implicitVolumeMounts, implicitEnvVars); err != nil { + if credsInitContainer, secretsVolumes, err := pod.CredsInit(images.CredsImage, taskRun.Spec.ServiceAccountName, taskRun.Namespace, kubeclient, implicitVolumeMounts, implicitEnvVars); err != nil { return nil, err } else if credsInitContainer != nil { initContainers = append(initContainers, *credsInitContainer) @@ -280,7 +280,7 @@ cat > ${tmpfile} << '%s' RestartPolicy: corev1.RestartPolicyNever, InitContainers: initContainers, Containers: mergedPodContainers, - ServiceAccountName: taskRun.GetServiceAccountName(), + ServiceAccountName: taskRun.Spec.ServiceAccountName, Volumes: volumes, NodeSelector: taskRun.Spec.PodTemplate.NodeSelector, Tolerations: taskRun.Spec.PodTemplate.Tolerations, diff --git a/pkg/reconciler/taskrun/resources/pod_test.go b/pkg/reconciler/taskrun/resources/pod_test.go index 73ae0d478f0..da8fc9b832d 100644 --- a/pkg/reconciler/taskrun/resources/pod_test.go +++ b/pkg/reconciler/taskrun/resources/pod_test.go @@ -137,49 +137,6 @@ func TestMakePod(t *testing.T) { }}, Volumes: append(secretsVolumes, implicitVolumes...), }, - }, { - desc: "with-deprecated-service-account", - ts: v1alpha1.TaskSpec{ - Steps: []v1alpha1.Step{{Container: corev1.Container{ - Name: "name", - Image: "image", - }}}, - }, - trs: v1alpha1.TaskRunSpec{ - DeprecatedServiceAccount: "service-account", - }, - want: &corev1.PodSpec{ - ServiceAccountName: "service-account", - RestartPolicy: corev1.RestartPolicyNever, - InitContainers: []corev1.Container{{ - Name: "credential-initializer-mz4c7", - Image: credsImage, - Command: []string{"/ko-app/creds-init"}, - Args: []string{ - "-basic-docker=multi-creds=https://docker.io", - "-basic-docker=multi-creds=https://us.gcr.io", - "-basic-git=multi-creds=github.com", - "-basic-git=multi-creds=gitlab.com", - }, - VolumeMounts: append(implicitVolumeMounts, secretsVolumeMounts...), - Env: implicitEnvVars, - }}, - Containers: []corev1.Container{{ - Name: "step-name", - Image: "image", - Env: implicitEnvVars, - VolumeMounts: implicitVolumeMounts, - WorkingDir: workspaceDir, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("0"), - corev1.ResourceMemory: resource.MustParse("0"), - corev1.ResourceEphemeralStorage: resource.MustParse("0"), - }, - }, - }}, - Volumes: append(secretsVolumes, implicitVolumes...), - }, }, { desc: "with-pod-template", ts: v1alpha1.TaskSpec{ diff --git a/pkg/reconciler/taskrun/taskrun_test.go b/pkg/reconciler/taskrun/taskrun_test.go index e83f291eec6..41ac70fc41c 100644 --- a/pkg/reconciler/taskrun/taskrun_test.go +++ b/pkg/reconciler/taskrun/taskrun_test.go @@ -432,9 +432,6 @@ func TestReconcile(t *testing.T) { taskRunWithSaSuccess := tb.TaskRun("test-taskrun-with-sa-run-success", "foo", tb.TaskRunSpec( tb.TaskRunTaskRef(saTask.Name, tb.TaskRefAPIVersion("a1")), tb.TaskRunServiceAccountName("test-sa"), )) - taskRunWithDeprecatedSaSuccess := tb.TaskRun("test-taskrun-with-deprecated-sa-run-success", "foo", tb.TaskRunSpec( - tb.TaskRunTaskRef(saTask.Name, tb.TaskRefAPIVersion("a1")), tb.TaskRunDeprecatedServiceAccount("", "test-deprecated-sa"), - )) taskRunTaskEnv := tb.TaskRun("test-taskrun-task-env", "foo", tb.TaskRunSpec( tb.TaskRunTaskRef(taskEnvTask.Name, tb.TaskRefAPIVersion("a1")), )) @@ -565,7 +562,7 @@ func TestReconcile(t *testing.T) { ) taskruns := []*v1alpha1.TaskRun{ - taskRunSuccess, taskRunWithSaSuccess, taskRunWithDeprecatedSaSuccess, + taskRunSuccess, taskRunWithSaSuccess, taskRunSubstitution, taskRunInputOutput, taskRunWithTaskSpec, taskRunWithClusterTask, taskRunWithResourceSpecAndTaskSpec, taskRunWithLabels, taskRunWithAnnotations, taskRunWithResourceRequests, taskRunTaskEnv, taskRunWithPod, @@ -644,38 +641,6 @@ func TestReconcile(t *testing.T) { ), ), ), - }, { - name: "deprecated-serviceaccount", - taskRun: taskRunWithDeprecatedSaSuccess, - wantPod: tb.Pod("test-taskrun-with-deprecated-sa-run-success-pod-d406f0", "foo", - tb.PodAnnotation("tekton.dev/ready", ""), - tb.PodLabel(taskNameLabelKey, "test-with-sa"), - tb.PodLabel(taskRunNameLabelKey, "test-taskrun-with-deprecated-sa-run-success"), - tb.PodLabel(resources.ManagedByLabelKey, resources.ManagedByLabelValue), - tb.PodOwnerReference("TaskRun", "test-taskrun-with-deprecated-sa-run-success", - tb.OwnerReferenceAPIVersion(currentApiVersion)), - tb.PodSpec( - tb.PodServiceAccountName("test-deprecated-sa"), - tb.PodVolumes(toolsVolume, downward, workspaceVolume, homeVolume), - tb.PodRestartPolicy(corev1.RestartPolicyNever), - getPlaceToolsInitContainer(), - tb.PodContainer("step-sa-step", "foo", - tb.Command(entrypointLocation), - tb.Args("-wait_file", "/builder/downward/ready", "-post_file", "/builder/tools/0", "-wait_file_content", "-entrypoint", "/mycmd", "--"), - tb.WorkingDir(workspaceDir), - tb.EnvVar("HOME", "/builder/home"), - tb.VolumeMount("tools", "/builder/tools"), - tb.VolumeMount("downward", "/builder/downward"), - tb.VolumeMount("workspace", workspaceDir), - tb.VolumeMount("home", "/builder/home"), - tb.Resources(tb.Requests( - tb.CPU("0"), - tb.Memory("0"), - tb.EphemeralStorage("0"), - )), - ), - ), - ), }, { name: "params", taskRun: taskRunSubstitution, @@ -1219,7 +1184,7 @@ func TestReconcile(t *testing.T) { defer cancel() c := testAssets.Controller clients := testAssets.Clients - saName := tc.taskRun.GetServiceAccountName() + saName := tc.taskRun.Spec.ServiceAccountName if saName == "" { saName = "default" } diff --git a/test/builder/pipeline.go b/test/builder/pipeline.go index ccb37c49ff6..0b9f93eef8c 100644 --- a/test/builder/pipeline.go +++ b/test/builder/pipeline.go @@ -352,14 +352,6 @@ func PipelineRunServiceAccountName(sa string) PipelineRunSpecOp { } } -// PipelineRunServiceAccount sets the service account to the PipelineRunSpec. -func PipelineRunDeprecatedServiceAccountName(sa, deprecatedSA string) PipelineRunSpecOp { - return func(prs *v1alpha1.PipelineRunSpec) { - prs.ServiceAccountName = sa - prs.DeprecatedServiceAccount = deprecatedSA - } -} - // PipelineRunServiceAccountTask configures the service account for given Task in PipelineRun. func PipelineRunServiceAccountNameTask(taskName, sa string) PipelineRunSpecOp { return func(prs *v1alpha1.PipelineRunSpec) { @@ -370,16 +362,6 @@ func PipelineRunServiceAccountNameTask(taskName, sa string) PipelineRunSpecOp { } } -// PipelineRunServiceAccountTask configures the service account for given Task in PipelineRun. -func PipelineRunDeprecatedServiceAccountTask(taskName, sa string) PipelineRunSpecOp { - return func(prs *v1alpha1.PipelineRunSpec) { - prs.DeprecatedServiceAccounts = append(prs.DeprecatedServiceAccounts, v1alpha1.DeprecatedPipelineRunSpecServiceAccount{ - TaskName: taskName, - DeprecatedServiceAccount: sa, - }) - } -} - // PipelineRunParam add a param, with specified name and value, to the PipelineRunSpec. func PipelineRunParam(name string, value string, additionalValues ...string) PipelineRunSpecOp { arrayOrString := ArrayOrString(value, additionalValues...) diff --git a/test/builder/task.go b/test/builder/task.go index bc13695f76d..ee4c715acc2 100644 --- a/test/builder/task.go +++ b/test/builder/task.go @@ -555,14 +555,6 @@ func TaskRunServiceAccountName(sa string) TaskRunSpecOp { } } -// TaskRunServiceAccount sets the serviceAccount to the TaskRunSpec. -func TaskRunDeprecatedServiceAccount(sa, deprecatedSA string) TaskRunSpecOp { - return func(trs *v1alpha1.TaskRunSpec) { - trs.ServiceAccountName = sa - trs.DeprecatedServiceAccount = deprecatedSA - } -} - // TaskRunInputs sets inputs to the TaskRunSpec. // Any number of TaskRunInputs modifier can be passed to transform it. func TaskRunInputs(ops ...TaskRunInputsOp) TaskRunSpecOp {