Skip to content

Commit b5d1090

Browse files
author
Matt Skinner
authored
GHM-822 Build virtalization package with secrets
1 parent d26f8b8 commit b5d1090

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
tmp/
22
/artifacts/
3+
.idea

packages/virtualization/config.sh

+48-5
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,57 @@ function build() {
5656
# Build the virtualization package
5757
#
5858
logmust cd "$WORKDIR/repo/appliance"
59+
60+
local args=()
61+
62+
# Here we check for whether the environment variables are set and pass them along. We check for
63+
# existence instead of emptiness to avoid adding a layer of interpretation.
64+
65+
# We use parameter expansion in the form of ${variable+nothing} which evaluates to the variable
66+
# 'nothing' if 'variable' is not set. Because 'nothing' is not defined it evaluates to "" when 'variable'
67+
# is not set. So [[ "" ]] is what is actually evaluated when 'variable' is not set.
68+
69+
if [[ ${SECRET_DB_USE_JUMPBOX+nothing} ]]; then
70+
args+=("-DSECRET_DB_USE_JUMPBOX=$SECRET_DB_USE_JUMPBOX")
71+
fi
72+
73+
if [[ ${SECRET_DB_JUMP_BOX_HOST+nothing} ]]; then
74+
args+=("-DSECRET_DB_JUMP_BOX_HOST=$SECRET_DB_JUMP_BOX_HOST")
75+
fi
76+
77+
if [[ ${SECRET_DB_JUMP_BOX_USER+nothing} ]]; then
78+
args+=("-DSECRET_DB_JUMP_BOX_USER=$SECRET_DB_JUMP_BOX_USER")
79+
fi
80+
81+
if [[ ${SECRET_DB_JUMP_BOX_PRIVATE_KEY+nothing} ]]; then
82+
if [[ ! -f "$SECRET_DB_JUMP_BOX_PRIVATE_KEY" ]]; then
83+
die "Jumpbox private key not found."
84+
fi
85+
args+=("-DSECRET_DB_JUMP_BOX_PRIVATE_KEY=$SECRET_DB_JUMP_BOX_PRIVATE_KEY")
86+
fi
87+
88+
if [[ ${SECRET_DB_AWS_ENDPOINT+nothing} ]]; then
89+
args+=("-DSECRET_DB_AWS_ENDPOINT=$SECRET_DB_AWS_ENDPOINT")
90+
fi
91+
92+
if [[ ${SECRET_DB_AWS_PROFILE+nothing} ]]; then
93+
args+=("-DSECRET_DB_AWS_PROFILE=$SECRET_DB_AWS_PROFILE")
94+
fi
95+
96+
if [[ ${SECRET_DB_AWS_REGION+nothing} ]]; then
97+
args+=("-DSECRET_DB_AWS_REGION=$SECRET_DB_AWS_REGION")
98+
fi
99+
100+
args+=("-Ddockerize=true")
101+
args+=("-DbuildJni=true")
102+
59103
if [[ -n "$DELPHIX_RELEASE_VERSION" ]]; then
60-
logmust ant -Ddockerize=true -DbuildJni=true \
61-
-DhotfixGenDlpxVersion="$DELPHIX_RELEASE_VERSION" \
62-
-Dbuild.legacy.resources.war=true all package
63-
else
64-
logmust ant -Ddockerize=true -DbuildJni=true all package
104+
args+=("-DhotfixGenDlpxVersion=$DELPHIX_RELEASE_VERSION")
105+
args+=("-Dbuild.legacy.resources.war=true")
65106
fi
66107

108+
logmust ant "${args[@]}" all-secrets package
109+
67110
#
68111
# Publish the virtualization package artifacts
69112
#

0 commit comments

Comments
 (0)