Skip to content

Commit

Permalink
Fix release pipeline to handle tektoncd#1122
Browse files Browse the repository at this point in the history
Since tektoncd#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.
  • Loading branch information
afrittoli committed Sep 18, 2019
1 parent 6e677da commit f89d1ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tekton/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ To use [`tkn`](https:/tektoncd/cli) to run the `publish-tekton-pipel
--resource=builtWebhookImage=webhook-image \
--resource=builtDigestExporterImage=digest-exporter-image \
--resource=builtPullRequestInitImage=pull-request-init-image \
--resource=builtGcsFetcherImage=gcs-fetcher-image \
--resource=builtGcsFetcherImage=gcs-fetcher-image \
pipeline-release
```

Expand Down
22 changes: 15 additions & 7 deletions tekton/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f89d1ac

Please sign in to comment.