From 9562237dedba7647e4405b8445d6e0e56c6d41f8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 27 Nov 2024 11:43:52 +0100 Subject: [PATCH] hack: add release script to generate download info This extracts a script from the release process document. This script can be invoked to create the downloads section for the release notes for a given release. Signed-off-by: Michael Adam --- docs/release-process.md | 47 ++++++---------------------- hack/release-gen-download-section.sh | 37 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 38 deletions(-) create mode 100755 hack/release-gen-download-section.sh diff --git a/docs/release-process.md b/docs/release-process.md index a081982..ab125b1 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -105,46 +105,17 @@ on GitHub (beyond the sources automatically provided there). Instead we add a Downloads section that notes the exact tags and digests that the images can be found at on quay.io. -The downloads section can be generated using the following shell script: -```bash -#!/usr/bin/env bash -# Requires `skopeo` and `jq` to be installed. - -set -e - -sk_digest() { - skopeo inspect "docker://${1}" | jq -r .Digest -} - -image_info() { - curr_img="quay.io/samba.org/${1}:${2}" - digest=$(sk_digest "${curr_img}") - # strip preN from tag name - final_tag="$(echo "$2" | sed 's,pre[0-9]*$,,')" - tag_img="quay.io/samba.org/${1}:${final_tag}" - dst_img="quay.io/samba.org/${1}@${digest}" - - echo "### $1" - echo "* By tag: $tag_img" - echo "* By digest: $dst_img" - echo "" -} - -wip_tag=$1 -if [ -z "${wip_tag}" ] ; then - echo "No tag provided!" >&2 - exit 1 -fi - -echo "## Downloads" -echo "" -echo "Images built for this release can be acquired from the quay.io image registry." -echo "" -for component in samba-server samba-ad-server samba-client samba-toolbox; do - image_info "${component}" "${wip_tag}" -done +The downloads section can be generated using the shell script +https://github.com/samba-in-kubernetes/samba-container/blob/master/hack/install-tools.sh in this repository. + +It needs to be invoked with the release tag as the only argument. E. G. : + +```console + +$ ./hack/release-gen-download-section.sh v0.3 ``` + It is important that the digest is fetched from qauy.io after it has been pushed. Do not use any local digest hashes. You may want to double check the values produced by the script with those in the quay.io UI. Click on the diff --git a/hack/release-gen-download-section.sh b/hack/release-gen-download-section.sh new file mode 100755 index 0000000..2fb6069 --- /dev/null +++ b/hack/release-gen-download-section.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Requires `skopeo` and `jq` to be installed. + +set -e + +sk_digest() { + skopeo inspect "docker://${1}" | jq -r .Digest +} + +image_info() { + curr_img="quay.io/samba.org/${1}:${2}" + digest=$(sk_digest "${curr_img}") + # strip preN from tag name + final_tag=${2/%pre[0-9]*/} + tag_img="quay.io/samba.org/${1}:${final_tag}" + dst_img="quay.io/samba.org/${1}@${digest}" + + echo "### $1" + echo "* By tag: $tag_img" + echo "* By digest: $dst_img" + echo "" +} + +wip_tag=$1 +if [ -z "${wip_tag}" ] ; then + echo "No tag provided!" >&2 + exit 1 +fi + +echo "## Downloads" +echo "" +echo "Images built for this release can be acquired from the quay.io image registry." +echo "" +for component in samba-server samba-ad-server samba-client samba-toolbox; do + image_info "${component}" "${wip_tag}" +done +