Merge remote-tracking branch 'origin/topic/awelzel/3287-push-rc-container-images'

* origin/topic/awelzel/3287-push-rc-container-images:
  cirrus/container_image_manifest: match RC tags, too
  cirrus: Move additional tag "computation" into separate script
This commit is contained in:
Tim Wojtulewicz 2024-12-13 12:14:17 -07:00
commit ef98afb29e
4 changed files with 63 additions and 28 deletions

View file

@ -599,7 +599,7 @@ container_image_manifest_docker_builder:
( $CIRRUS_CRON == '' ) &&
( $CIRRUS_REPO_FULL_NAME == 'zeek/zeek' &&
( $CIRRUS_BRANCH == 'master' ||
$CIRRUS_TAG =~ 'v[0-9]+\.[0-9]+\.[0-9]+$' ) )
$CIRRUS_TAG =~ 'v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$' ) )
env:
DOCKER_USERNAME: ENCRYPTED[!505b3dee552a395730a7e79e6aab280ffbe1b84ec62ae7616774dfefe104e34f896d2e20ce3ad701f338987c13c33533!]
DOCKER_PASSWORD: ENCRYPTED[!6c4b2f6f0e5379ef1091719cc5d2d74c90cfd2665ac786942033d6d924597ffb95dbbc1df45a30cc9ddeec76c07ac620!]
@ -618,8 +618,12 @@ container_image_manifest_docker_builder:
# for tags, or zeek/zeek-dev:latest for pushes to master.
set -x
if [ -n "${CIRRUS_TAG}" ]; then
echo "IMAGE_TAG=$(cat VERSION)" >> $CIRRUS_ENV
echo "IMAGE_NAME=zeek" >> $CIRRUS_ENV
echo "IMAGE_TAG=$(cat VERSION)" >> $CIRRUS_ENV
if [ "${CIRRUS_TAG}" != "v$(cat VERSION)" ]; then
echo "CIRRUS_TAG '${CIRRUS_TAG}' and VERSION '$(cat VERSION)' inconsistent!" >&2
exit 1
fi
elif [ "${CIRRUS_BRANCH}" = "master" ]; then
echo "IMAGE_NAME=zeek-dev" >> $CIRRUS_ENV
echo "IMAGE_TAG=latest" >> $CIRRUS_ENV
@ -646,31 +650,7 @@ container_image_manifest_docker_builder:
'+refs/heads/release/*:refs/remotes/origin/release/*' \
'+refs/heads/master:refs/remotes/origin/master'
# 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 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
./ci/container-images-addl-tags.sh "${CIRRUS_TAG}" | tee -a $CIRRUS_ENV
# These should've been populated by the previous jobs
zeek_image_arm64_cache:

11
CHANGES
View file

@ -1,3 +1,14 @@
7.1.0-dev.821 | 2024-12-13 12:14:17 -0700
* cirrus/container_image_manifest: match RC tags, too (Arne Welzel, Corelight)
The rest should just work, assuming VERSION files contain an
appropriate value. Add a check for that, too.
* cirrus: Move additional tag "computation" into separate script (Arne Welzel, Corelight)
This allows for easier testing locally and maybe re-usability.
7.1.0-dev.818 | 2024-12-13 08:04:17 -0700
* fix for memory management associated with ZAM table iteration (Vern Paxson, Corelight)

View file

@ -1 +1 @@
7.1.0-dev.818
7.1.0-dev.821

View 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}"