Skip to content

Commit

Permalink
dag: fix create-dir containers name… 🏈
Browse files Browse the repository at this point in the history
… make sure we don't have 2 containers with the same name.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester committed Feb 6, 2019
1 parent 794dc40 commit 5e3a989
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func TestAddResourceToBuild(t *testing.T) {
wantErr: false,
want: buildv1alpha1.BuildSpec{
Steps: []corev1.Container{{
Name: "create-dir-gitspace",
Name: "create-dir-gitspace-0-0",
Image: "override-with-bash-noop:latest",
Args: []string{"-args", "mkdir -p /workspace/gitspace"},
}, {
Expand Down Expand Up @@ -515,7 +515,7 @@ func TestAddResourceToBuild(t *testing.T) {
wantErr: false,
want: buildv1alpha1.BuildSpec{
Steps: []corev1.Container{{
Name: "create-dir-workspace",
Name: "create-dir-workspace-0-0",
Image: "override-with-bash-noop:latest",
Args: []string{"-args", "mkdir -p /workspace/gcs-dir"},
}, {
Expand Down
5 changes: 3 additions & 2 deletions pkg/reconciler/v1alpha1/taskrun/resources/input_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ func AddInputResource(
if as.GetType() == v1alpha1.ArtifactStoragePVCType {

mountPVC = true
for _, ct := range cpContainers {
for j, ct := range cpContainers {
ct.VolumeMounts = []corev1.VolumeMount{getPvcMount(pvcName)}
createAndCopyContainers := []corev1.Container{v1alpha1.CreateDirContainer(boundResource.Name, dPath), ct}
name := fmt.Sprintf("%s-%d-%d", boundResource.Name, i, j)
createAndCopyContainers := []corev1.Container{v1alpha1.CreateDirContainer(name, dPath), ct}
copyStepsFromPrevTasks = append(copyStepsFromPrevTasks, createAndCopyContainers...)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/v1alpha1/taskrun/taskrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,14 @@ func TestReconcile(t *testing.T) {
name: "wrap-steps",
taskRun: taskRunInputOutput,
wantBuildSpec: tb.BuildSpec(
tb.BuildStep("create-dir-another-git-resource", "override-with-bash-noop:latest",
tb.BuildStep("create-dir-another-git-resource-0-0", "override-with-bash-noop:latest",
tb.Args("-args", "mkdir -p /workspace/another-git-resource"),
),
tb.BuildStep("source-copy-another-git-resource-0", "override-with-bash-noop:latest",
tb.Args("-args", "cp -r source-folder/. /workspace/another-git-resource"),
tb.VolumeMount(corev1.VolumeMount{Name: "test-pvc", MountPath: "/pvc"}),
),
tb.BuildStep("create-dir-git-resource", "override-with-bash-noop:latest",
tb.BuildStep("create-dir-git-resource-0-0", "override-with-bash-noop:latest",
tb.Args("-args", "mkdir -p /workspace/git-resource"),
),
tb.BuildStep("source-copy-git-resource-0", "override-with-bash-noop:latest",
Expand Down

0 comments on commit 5e3a989

Please sign in to comment.