Skip to content

Commit de6a35d

Browse files
committed
ci(ct): add damp-run mode to maintenance scripts
With damp run we actually build the image, but refrain from the deployment step. This way one may check if the Maven args are all what they should look like.
1 parent 1887178 commit de6a35d

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/scripts/containers/maintain-application.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# - You added a PLATFORMS env var with all the target platforms you want to build for
1313
# Optional:
1414
# - Use DRY_RUN=1 env var to skip actually building, but see how the tag lookups play out
15+
# - Use DAMP_RUN=1 env var to skip pushing images, but build them
1516

1617
# NOTE:
1718
# This script is a culmination of Github Action steps into a single script.
@@ -33,6 +34,7 @@ MAINTENANCE_WORKSPACE="${GITHUB_WORKSPACE}/maintenance-job"
3334
DEVELOPMENT_BRANCH="${DEVELOPMENT_BRANCH:-"develop"}"
3435
FORCE_BUILD="${FORCE_BUILD:-"0"}"
3536
DRY_RUN="${DRY_RUN:-"0"}"
37+
DAMP_RUN="${DAMP_RUN:-"0"}"
3638
PLATFORMS="${PLATFORMS:-"linux/amd64,linux/arm64"}"
3739

3840
# Setup and validation
@@ -41,6 +43,11 @@ if [[ -z "$*" ]]; then
4143
exit 1;
4244
fi
4345

46+
if (( DRY_RUN + DAMP_RUN > 1 )); then
47+
>&2 echo "You must either use DRY_RUN=1 or DAMP_RUN=1, but not both"
48+
exit 1;
49+
fi
50+
4451
source "$( dirname "$0" )/utils.sh"
4552

4653
# Delete old stuff if present
@@ -139,8 +146,10 @@ for BRANCH in "$@"; do
139146
if (( NEWER_BASE_IMAGE + FORCE_BUILD > 0 )); then
140147
if ! (( DRY_RUN )); then
141148
# Build the application image, but skip the configbaker image (that's a different job)!
149+
# shellcheck disable=SC2046
142150
mvn -Pct -f . deploy -Ddocker.noCache -Ddocker.platforms="${PLATFORMS}" \
143151
-Dconf.skipBuild -Ddocker.imagePropertyConfiguration=override $TAG_OPTIONS
152+
$( if (( DAMP_RUN )); then echo "-Ddocker.skip.push -Ddocker.skip.tag"; fi )
144153
else
145154
echo "Skipping Maven build as requested by DRY_RUN=1"
146155
fi

.github/workflows/scripts/containers/maintain-base.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# - You added a PLATFORMS env var with all the target platforms you want to build for
1313
# Optional:
1414
# - Use DRY_RUN=1 env var to skip actually building, but see how the tag lookups play out
15+
# - Use DAMP_RUN=1 env var to skip pushing images, but build them
1516

1617
# NOTE:
1718
# This script is a culmination of Github Action steps into a single script.
@@ -33,6 +34,7 @@ MAINTENANCE_WORKSPACE="${GITHUB_WORKSPACE}/maintenance-job"
3334
DEVELOPMENT_BRANCH="${DEVELOPMENT_BRANCH:-"develop"}"
3435
FORCE_BUILD="${FORCE_BUILD:-"0"}"
3536
DRY_RUN="${DRY_RUN:-"0"}"
37+
DAMP_RUN="${DAMP_RUN:-"0"}"
3638
PLATFORMS="${PLATFORMS:-"linux/amd64,linux/arm64"}"
3739

3840
# Setup and validation
@@ -41,6 +43,11 @@ if [[ -z "$*" ]]; then
4143
exit 1;
4244
fi
4345

46+
if (( DRY_RUN + DAMP_RUN > 1 )); then
47+
>&2 echo "You must either use DRY_RUN=1 or DAMP_RUN=1, but not both"
48+
exit 1;
49+
fi
50+
4451
source "$( dirname "$0" )/utils.sh"
4552

4653
# Delete old stuff if present
@@ -134,8 +141,10 @@ for BRANCH in "$@"; do
134141
NEWER_IMAGE=0
135142
if (( NEWER_JAVA_IMAGE + NEWER_PKGS + FORCE_BUILD > 0 )); then
136143
if ! (( DRY_RUN )); then
144+
# shellcheck disable=SC2046
137145
mvn -Pct -f modules/container-base deploy -Ddocker.noCache -Ddocker.platforms="${PLATFORMS}" \
138-
-Ddocker.imagePropertyConfiguration=override $TAG_OPTIONS
146+
-Ddocker.imagePropertyConfiguration=override $TAG_OPTIONS \
147+
$( if (( DAMP_RUN )); then echo "-Ddocker.skip.push -Ddocker.skip.tag"; fi )
139148
else
140149
echo "Skipping Maven build as requested by DRY_RUN=1"
141150
fi

0 commit comments

Comments
 (0)