Skip to content

Commit

Permalink
Fixes Triggers release pipeline and tasks
Browse files Browse the repository at this point in the history
Fix `ko resolve` step in `publish-tekton-triggers` task

Fix `koparse` error

```
Expected images did not match: Images ['gcr.io/tekton-nightly/github.com/tektoncd/triggers/cmd/binding-eval:v20210331-6cc9094a8a', 'gcr.io/tekton-nightly/github.com/tektoncd/triggers/cmd/triggerrun:v20210331-6cc9094a8a', 'gcr.io/tekton-nightly/github.com/tektoncd/triggers/cmd/interceptors:v20210331-6cc9094a8a'] were expected but missing.
```

Tested by running a nightly release: https://dashboard.dogfooding.tekton.dev/#/namespaces/tekton-nightly/pipelineruns/triggers-release-nightly-vp46d?pipelineTask=git-clone&step=clone

Signed-off-by: Nikhil Thomas <[email protected]>
  • Loading branch information
nikhil-thomas authored and tekton-robot committed Mar 31, 2021
1 parent 0adb610 commit f0c544c
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tekton/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ spec:
description: package to release (e.g. github.com/<org>/<project>)
default: github.com/tektoncd/triggers
- name: images
description: List of cmd/* paths to be published as images
default: "binding-eval controller eventlistenersink interceptors triggerrun webhook"
description: List of cmd/* paths to be published as images in release manifest release.yaml
default: "controller eventlistenersink webhook"
- name: interceptorImages
description: List of cmd/* paths to be published as images in release manifest interceptors.yaml
default: "interceptors"
- name: versionTag
description: The vX.Y.Z version that the artifacts should be tagged with (including `v`)
- name: imageRegistry
Expand Down Expand Up @@ -110,16 +113,18 @@ spec:
done
# Rewrite "devel" to params.versionTag
sed -i -e 's/\(pipeline.tekton.dev\/release\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(app.kubernetes.io\/version\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(version\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\("-version"\), "devel"/\1, "$(params.versionTag)"/g' ${PROJECT_ROOT}/config/*.yaml
sed -i -e 's/\(triggers.tekton.dev\/release\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(app.kubernetes.io\/version\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(version\): "devel"/\1: "$(params.versionTag)"/g' ${PROJECT_ROOT}/config/*.yaml
sed -i -e 's/\(triggers.tekton.dev\/release\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(app.kubernetes.io\/version\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(version\): "devel"/\1: "$(params.versionTag)"/g' ${PROJECT_ROOT}/config/interceptors/*.yaml
# Publish images and create release.yaml
mkdir -p $OUTPUT_RELEASE_DIR
ko resolve --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f ${PROJECT_ROOT}/config/ > $OUTPUT_RELEASE_DIR/release.yaml
ko resolve --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f ${PROJECT_ROOT}/config/interceptors > $OUTPUT_RELEASE_DIR/interceptors.yaml
# Publish images and create release.notags.yaml
# This is useful if your container runtime doesn't support the `image-reference:tag@digest` notation
# This is currently the case for `cri-o` (and most likely others)
ko resolve --platform=$(params.platforms) --preserve-import-paths -f ${PROJECT_ROOT}/config/ > $OUTPUT_RELEASE_DIR/release.notags.yaml
ko resolve --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f ${PROJECT_ROOT}/config/ > $OUTPUT_RELEASE_DIR/release.notags.yaml
ko resolve --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f ${PROJECT_ROOT}/config/interceptors > $OUTPUT_RELEASE_DIR/interceptors.notags.yaml
- name: koparse
image: gcr.io/tekton-releases/dogfooding/koparse:latest
Expand All @@ -138,6 +143,16 @@ spec:
--path $OUTPUT_RELEASE_DIR/release.yaml \
--base ${IMAGES_PATH} --images ${IMAGES} > /workspace/built_images
for cmd in $(params.interceptorImages)
do
INTERCEPTOR_IMAGES="${INTERCEPTOR_IMAGES} ${IMAGES_PATH}/cmd/${cmd}:$(params.versionTag)"
done
# Parse the built images from the interceptor.yaml generated by ko
koparse \
--path $OUTPUT_RELEASE_DIR/interceptors.yaml \
--base ${IMAGES_PATH} --images ${INTERCEPTOR_IMAGES} > /workspace/built_images
- name: tag-images
image: gcr.io/go-containerregistry/crane:debug
script: |
Expand Down

0 comments on commit f0c544c

Please sign in to comment.