Skip to content

Commit e46e949

Browse files
committed
static: prevent empty env-vars from overriding build-arg defaults
Jenkins may set parameters to an empty value, in which case the build-args may be overriding the default value with an empty value. This patch explicitly unsets variables if they're empty (or not set). Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 0d72e44 commit e46e949

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

static/build-static

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/usr/bin/env bash
22
set -e
33

4+
for varName in CONTAINERD_VERSION DEFAULT_PRODUCT_LICENSE PACKAGER_NAME PLATFORM PRODUCT RUNC_VERSION; do
5+
# Prevent empty environment variables from overriding build-arg defaults.
6+
# Jenkins may set the variable, but as an empty string.
7+
if [ -z "${!varName}" ]; then
8+
unset "$varName"
9+
fi
10+
done
11+
412
source "../scripts/target-platform"
513

614
CURDIR="$1"

0 commit comments

Comments
 (0)