From 64393fa52272953519e42cb44d9c0502f9b8766a Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Tue, 17 Sep 2019 23:27:45 +0100 Subject: [PATCH] Fix release pipeline to handle #1122 Since #1122, we do not treat outputs that were inputs as well in any special way, meaning that the output folder will be empty unless we copy the input to the output. Fix the release pipeline to handle that. Fixes: #1325 --- tekton/publish.yaml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tekton/publish.yaml b/tekton/publish.yaml index 42fc1b4f1ab..0a8c349d04e 100644 --- a/tekton/publish.yaml +++ b/tekton/publish.yaml @@ -87,13 +87,21 @@ spec: cat /workspace/go/src/github.com/tektoncd/pipeline/.ko.yaml + - name: link-input-bucket-to-output + image: busybox + command: ["cp"] + args: + - -r + - "/workspace/bucket" + - "/workspace/output/" + - name: ensure-release-dirs-exist image: busybox command: ["mkdir"] args: - "-p" - - "/workspace/bucket/latest/" - - "/workspace/bucket/previous/" + - "/workspace/output/bucket/latest/" + - "/workspace/output/bucket/previous/" - name: run-ko # TODO(#639) we should be able to use the image built by an upstream Task here instead of hardcoding @@ -123,14 +131,14 @@ spec: cd /workspace/go/src/github.com/tektoncd/pipeline # Publish images and create release.yaml - ko resolve --preserve-import-paths -f /workspace/go/src/github.com/tektoncd/pipeline/config/ > /workspace/bucket/latest/release.yaml + ko resolve --preserve-import-paths -f /workspace/go/src/github.com/tektoncd/pipeline/config/ > /workspace/output/bucket/latest/release.yaml volumeMounts: - name: gcp-secret mountPath: /secret - name: copy-to-tagged-bucket image: busybox - workingDir: "/workspace/bucket" + workingDir: "/workspace/output/bucket" command: - /bin/sh args: @@ -139,8 +147,8 @@ spec: set -e set -x - mkdir -p /workspace/bucket/previous/$(inputs.params.versionTag)/ - cp /workspace/bucket/latest/release.yaml /workspace/bucket/previous/$(inputs.params.versionTag)/release.yaml + mkdir -p /workspace/output/bucket/previous/$(inputs.params.versionTag)/ + cp /workspace/output/bucket/latest/release.yaml /workspace/output/bucket/previous/$(inputs.params.versionTag)/release.yaml - name: tag-images image: google/cloud-sdk @@ -168,7 +176,7 @@ spec: ${inputs.params.imageRegistry}/${inputs.params.pathToProject}/${outputs.resources.builtGcsFetcherImage.url} ) # Parse the built images from the release.yaml generated by ko - BUILT_IMAGES=( $(/workspace/go/src/github.com/tektoncd/pipeline/tekton/koparse/koparse.py --path /workspace/bucket/latest/release.yaml --base ${inputs.params.imageRegistry}/${inputs.params.pathToProject} --images ${IMAGES[@]}) ) + BUILT_IMAGES=( $(/workspace/go/src/github.com/tektoncd/pipeline/tekton/koparse/koparse.py --path /workspace/output/bucket/latest/release.yaml --base ${inputs.params.imageRegistry}/${inputs.params.pathToProject} --images ${IMAGES[@]}) ) # Auth with account credentials gcloud auth activate-service-account --key-file=/secret/release.json