Skip to content

Commit

Permalink
[release-1.9] fix: Fix tagging of kn container image for latest relea…
Browse files Browse the repository at this point in the history
…ses (#1795)

* fix: Fix tagging of kn container image for latest releases

* fix: Reflect shell suggestions

---------

Co-authored-by: David Simansky <[email protected]>
  • Loading branch information
knative-prow-robot and dsimansk committed Mar 23, 2023
1 parent 1ce39bb commit ffbb229
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,30 @@ function build_release() {
echo "🚧 P Building for Linux (ppc64le)"
GOOS=linux GOARCH=ppc64le go build -mod=vendor -ldflags "${ld_flags}" -o ./kn-linux-ppc64le ./cmd/...
echo "🚧 🐳 Building the container image"
ko resolve ${KO_FLAGS} -f config/ > kn-image-location.yaml

# Handle latest default tag in `ko` to be present only for latest releases.
# Latest .0 or subsequent patch releases of current minor (e.g. v1.9.z) are tagged with latest.
# Set empty --tags "" for patch release of older minors (e.g. v1.8.z).
#
# Tagging of images by the $TAG variable is done in `tag_images_in_yamls()` of hack/release.sh.
#
if [ "$(patch_version "${TAG}")" == 0 ]; then
echo "Newest .0 release - publish latest image tag"
else
local latest_minor=$(minor_version "$(latest_version)")
local current_minor=$(minor_version "${TAG}")
if ((current_minor >= latest_minor)); then
echo "Newer patch release - publish latest image tag"
else
echo "Patch release of older minor version - do not publish lates image tag"
KO_FLAGS=$KO_FLAGS" --tags \"\""
fi
fi
echo "KO_FLAGS:${KO_FLAGS}"

ko resolve ${KO_FLAGS} -f config/ >kn-image-location.yaml
ARTIFACTS_TO_PUBLISH="kn-darwin-amd64 kn-darwin-arm64 kn-linux-amd64 kn-linux-arm64 kn-windows-amd64.exe kn-linux-s390x kn-linux-ppc64le kn-image-location.yaml"
sha256sum ${ARTIFACTS_TO_PUBLISH} > checksums.txt
sha256sum ${ARTIFACTS_TO_PUBLISH} >checksums.txt
ARTIFACTS_TO_PUBLISH="${ARTIFACTS_TO_PUBLISH} checksums.txt"
echo "🧮 Checksum:"
cat checksums.txt
Expand Down

0 comments on commit ffbb229

Please sign in to comment.