Skip to content

Commit

Permalink
Fix release task by copying input bucket contents
Browse files Browse the repository at this point in the history
Pipeline 0.7 does not automatically copy input contents to
the output folder for resources that are used both as input as
well as output. See tektoncd/pipeline#1118.

This change updates the release publish task to manually copy over
the contents of the input release bucket.

Signed-off-by: Dibyo Mukherjee <[email protected]>
  • Loading branch information
dibyom authored and tekton-robot committed Oct 8, 2019
1 parent c45eba3 commit 4ffc356
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tekton/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,20 @@ spec:
- name: builtEventListenerSinkImage
type: image
steps:
- 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/triggers/latest/"
- "/workspace/bucket/triggers/previous/"
- "/workspace/output/bucket/triggers/latest/"
- "/workspace/output/bucket/triggers/previous/"

- name: run-ko
image: gcr.io/tekton-releases/ko-ci
Expand Down Expand Up @@ -63,14 +70,14 @@ spec:
cd /workspace/go/src/github.com/tektoncd/triggers
# Publish images and create release.yaml
ko resolve --preserve-import-paths -f /workspace/go/src/github.com/tektoncd/triggers/config/ > /workspace/bucket/triggers/latest/release.yaml
ko resolve --preserve-import-paths -f /workspace/go/src/github.com/tektoncd/triggers/config/ > /workspace/output/bucket/triggers/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:
Expand All @@ -79,8 +86,8 @@ spec:
set -e
set -x
mkdir -p /workspace/bucket/triggers/previous/$(inputs.params.versionTag)/
cp /workspace/bucket/triggers/latest/release.yaml /workspace/bucket/triggers/previous/$(inputs.params.versionTag)/release.yaml
mkdir -p /workspace/output/bucket/triggers/previous/$(inputs.params.versionTag)/
cp /workspace/output/bucket/triggers/latest/release.yaml /workspace/output/bucket/triggers/previous/$(inputs.params.versionTag)/release.yaml
- name: tag-images
image: google/cloud-sdk
Expand All @@ -99,7 +106,7 @@ spec:
${inputs.params.imageRegistry}/${inputs.params.pathToProject}/${outputs.resources.builtEventListenerSinkImage.url}
)
# Parse the built images from the release.yaml generated by ko
BUILT_IMAGES=( $(/workspace/go/src/github.com/tektoncd/triggers/tekton/koparse/koparse.py --path /workspace/bucket/triggers/latest/release.yaml --base ${inputs.params.imageRegistry}/${inputs.params.pathToProject} --images ${IMAGES[@]}) )
BUILT_IMAGES=( $(/workspace/go/src/github.com/tektoncd/triggers/tekton/koparse/koparse.py --path /workspace/output/bucket/triggers/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
Expand Down

0 comments on commit 4ffc356

Please sign in to comment.