mirror of
https://github.com/zeek/zeek.git
synced 2025-10-01 22:28:20 +00:00
cirrus: Move additional tag "computation" into separate script
This allows for easier testing locally and maybe re-usability.
This commit is contained in:
parent
9c5c8b55cc
commit
eac91fdc24
2 changed files with 45 additions and 25 deletions
26
.cirrus.yml
26
.cirrus.yml
|
@ -646,31 +646,7 @@ container_image_manifest_docker_builder:
|
||||||
'+refs/heads/release/*:refs/remotes/origin/release/*' \
|
'+refs/heads/release/*:refs/remotes/origin/release/*' \
|
||||||
'+refs/heads/master:refs/remotes/origin/master'
|
'+refs/heads/master:refs/remotes/origin/master'
|
||||||
|
|
||||||
# Find current versions for lts and feature depending on branches and
|
./ci/container-images-addl-tags.sh "${CIRRUS_TAG}" | tee -a $CIRRUS_ENV
|
||||||
# tags in the repo. sed for escaping the dot in the version for using
|
|
||||||
# it in the regex below to match against CIRRUS_TAG.
|
|
||||||
lts_ver=$(./ci/find-current-version.sh lts)
|
|
||||||
lts_pat="^v$(echo $lts_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
|
|
||||||
feature_ver=$(./ci/find-current-version.sh feature)
|
|
||||||
feature_pat="^v$(echo $feature_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
|
|
||||||
|
|
||||||
# Construct additional tags for the image. At most this will
|
|
||||||
# be "lts x.0 feature" for an lts branch x.0 that is currently
|
|
||||||
# also the latest feature branch.
|
|
||||||
ADDL_MANIFEST_TAGS=
|
|
||||||
if echo "${CIRRUS_TAG}" | grep -E "${lts_pat}"; then
|
|
||||||
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} lts ${lts_ver}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if echo "${CIRRUS_TAG}" | grep -E "${feature_pat}"; then
|
|
||||||
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} latest"
|
|
||||||
if [ "${feature_ver}" != "${lts_ver}" ]; then
|
|
||||||
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} ${feature_ver}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Let downstream know about it.
|
|
||||||
echo "ADDITIONAL_MANIFEST_TAGS=${ADDL_MANIFEST_TAGS}" >> $CIRRUS_ENV
|
|
||||||
|
|
||||||
# These should've been populated by the previous jobs
|
# These should've been populated by the previous jobs
|
||||||
zeek_image_arm64_cache:
|
zeek_image_arm64_cache:
|
||||||
|
|
44
ci/container-images-addl-tags.sh
Executable file
44
ci/container-images-addl-tags.sh
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script produces output in the form of
|
||||||
|
#
|
||||||
|
# $ REMOTE=awelzel ./ci/container-images-addl-tags.sh v7.0.5
|
||||||
|
# ADDITIONAL_MANIFEST_TAGS= lts 7.0 latest
|
||||||
|
#
|
||||||
|
# This scripts expects visibility to all tags and release branches
|
||||||
|
# to work correctly. See the find-current-version.sh for details.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
dir="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
|
||||||
|
if [ $# -ne 1 ] || [ -z "${1}" ]; then
|
||||||
|
echo "Usage: $0 <tag>" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TAG="${1}"
|
||||||
|
|
||||||
|
# Find current versions for lts and feature depending on branches and
|
||||||
|
# tags in the repo. sed for escaping the dot in the version for using
|
||||||
|
# it in the regex below to match against TAG.
|
||||||
|
lts_ver=$(${dir}/find-current-version.sh lts)
|
||||||
|
lts_pat="^v$(echo $lts_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
|
||||||
|
feature_ver=$(${dir}/find-current-version.sh feature)
|
||||||
|
feature_pat="^v$(echo $feature_ver | sed 's,\.,\\.,g')\.[0-9]+\$"
|
||||||
|
|
||||||
|
# Construct additional tags for the image. At most this will
|
||||||
|
# be "lts x.0 feature" for an lts branch x.0 that is currently
|
||||||
|
# also the latest feature branch.
|
||||||
|
ADDL_MANIFEST_TAGS=
|
||||||
|
if echo "${TAG}" | grep -q -E "${lts_pat}"; then
|
||||||
|
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} lts ${lts_ver}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "${TAG}" | grep -q -E "${feature_pat}"; then
|
||||||
|
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} latest"
|
||||||
|
if [ "${feature_ver}" != "${lts_ver}" ]; then
|
||||||
|
ADDL_MANIFEST_TAGS="${ADDL_MANIFEST_TAGS} ${feature_ver}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "ADDITIONAL_MANIFEST_TAGS=${ADDL_MANIFEST_TAGS}"
|
Loading…
Add table
Add a link
Reference in a new issue