Skip to content

Commit

Permalink
Port publish.yml changes on ko publishing tags to nightly 🍊
Browse files Browse the repository at this point in the history
- Use `ko` to publish tags while resolving and building the image
- Move `generate-release-version` task above to have the `VERSION_TAG`
  variable computed already.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester committed Nov 7, 2019
1 parent 29197f5 commit 323bdc3
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions tekton/publish-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@ spec:
- "/workspace/bucket/latest/"
- "/workspace/bucket/previous/"

- name: generate-release-version
image: alpine/git
command:
- /bin/sh
args:
- -ce
- |
set -e
set -x
# Can't use workingDir due to #1267
cd /workspace/go/src/github.com/tektoncd/pipeline
# Nightly releases use vYYYYMMDD-commit
COMMIT=$(git rev-parse HEAD | cut -c 1-10)
DATE=$(date +"%Y%m%d")
VERSION_TAG="$DATE-$COMMIT"
echo $VERSION_TAG > "/builder/home/version"
- name: run-ko
# TODO(#639) we should be able to use the image built by an upstream Task here instead of hardcoding
image: gcr.io/tekton-nightly/ko-ci
Expand All @@ -110,6 +130,9 @@ spec:
set -e
set -x
# TODO(https://github.com/tektoncd/triggers/issues/87) if the versionTag could be generated dynamically, we could use the same Task for nightly + official releases
export VERSION_TAG="$(cat /builder/home/version)"
# Auth with CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
gcloud auth configure-docker
Expand All @@ -133,31 +156,11 @@ spec:
done
# 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 -t $VERSION_TAG -f /workspace/go/src/github.com/tektoncd/pipeline/config/ > /workspace/bucket/latest/release.yaml
volumeMounts:
- name: gcp-secret
mountPath: /secret

- name: generate-release-version
image: alpine/git
command:
- /bin/sh
args:
- -ce
- |
set -e
set -x
# Can't use workingDir due to #1267
cd /workspace/go/src/github.com/tektoncd/pipeline
# Nightly releases use vYYYYMMDD-commit
COMMIT=$(git rev-parse HEAD | cut -c 1-10)
DATE=$(date +"%Y%m%d")
VERSION_TAG="$DATE-$COMMIT"
echo $VERSION_TAG > "/builder/home/version"
- name: copy-to-tagged-bucket
image: busybox
command:
Expand Down Expand Up @@ -215,7 +218,6 @@ spec:
do
IMAGE_WITHOUT_SHA=${IMAGE%%@*}
gcloud -q container images add-tag ${IMAGE} ${IMAGE_WITHOUT_SHA}:latest
gcloud -q container images add-tag ${IMAGE} ${IMAGE_WITHOUT_SHA}:$VERSION_TAG
for REGION in "${REGIONS[@]}"
do
for TAG in "latest" $VERSION_TAG
Expand Down

0 comments on commit 323bdc3

Please sign in to comment.