Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically create named directories for each output resource in a … #1156

Merged
merged 1 commit into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1alpha1/artifact_pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func GetPvcMount(name string) corev1.VolumeMount {
// CreateDirContainer returns a container step to create a dir
func CreateDirContainer(name, destinationPath string) corev1.Container {
return corev1.Container{
Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("create-dir-%s", name)),
Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("create-dir-%s", strings.ToLower(name))),
Image: *BashNoopImage,
Command: []string{"/ko-app/bash"},
Args: []string{"-args", strings.Join([]string{"mkdir", "-p", destinationPath}, " ")},
Expand Down
4 changes: 4 additions & 0 deletions pkg/reconciler/v1alpha1/taskrun/resources/output_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func AddOutputResources(
resourceVolumes = append(resourceVolumes, as.GetSecretsVolumes()...)
}

// Add containers to mkdir each output directory. This should run before the build steps themselves.
mkdirStep := []corev1.Container{v1alpha1.CreateDirContainer(boundResource.Name, sourcePath)}
taskSpec.Steps = append(mkdirStep, taskSpec.Steps...)

taskSpec.Steps = append(taskSpec.Steps, resourceContainers...)
taskSpec.Volumes = append(taskSpec.Volumes, resourceVolumes...)

Expand Down
Loading