From 11caba6d3c3e70b2264063bdc093cf9748031968 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Thu, 7 Nov 2019 17:31:07 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Remove=20gcloud=20push=20with=20tag=20versi?= =?UTF-8?q?on=20=F0=9F=8C=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It should already be done by `ko resolve …` in a previous step. Signed-off-by: Vincent Demeester --- tekton/publish.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tekton/publish.yaml b/tekton/publish.yaml index f1e764dfcd2..acaf8a82b9f 100644 --- a/tekton/publish.yaml +++ b/tekton/publish.yaml @@ -197,7 +197,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}:$(inputs.params.versionTag) for REGION in "${REGIONS[@]}" do for TAG in "latest" $(inputs.params.versionTag) From 7d3871756d4dc9000e6c38960c718eca00b2ac18 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Thu, 7 Nov 2019 17:33:30 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Port=20publish.yml=20changes=20on=20ko=20pu?= =?UTF-8?q?blishing=20tags=20to=20nightly=20=F0=9F=8D=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- tekton/publish-nightly.yaml | 46 +++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/tekton/publish-nightly.yaml b/tekton/publish-nightly.yaml index b3334c9d941..382b67d6a22 100644 --- a/tekton/publish-nightly.yaml +++ b/tekton/publish-nightly.yaml @@ -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 @@ -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 @@ -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: @@ -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