Skip to content

Commit e55022a

Browse files
author
Matt Skinner
authored
GHM-822 Build virtalization package with secrets (#256)
GHM-822 Build virtalization package with secrets
1 parent 62ca13d commit e55022a

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
tmp/
22
/artifacts/
3+
.idea

packages/virtualization/config.sh

Lines changed: 48 additions & 5 deletions
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+
# Because ant does not read the environment variables of the execution context, we set them as
63+
# parameters only if they exist in the execution context
64+
65+
# Here we check for whether the environment variables are set and pass them along. We check for
66+
# existence instead of emptiness to avoid adding a layer of interpretation.
67+
68+
# We use parameter expansion in the form of ${variable+nothing} which evaluates to the variable
69+
# 'nothing' if 'variable' is not set. Because 'nothing' is not defined it evaluates to "" when 'variable'
70+
# is not set. So [[ "" ]] is what is actually evaluated when 'variable' is not set.
71+
72+
if [[ ${SECRET_DB_USE_JUMPBOX+nothing} ]]; then
73+
args+=("-DSECRET_DB_USE_JUMPBOX=\"$SECRET_DB_USE_JUMPBOX\"")
74+
fi
75+
76+
if [[ ${SECRET_DB_JUMP_BOX_HOST+nothing} ]]; then
77+
args+=("-DSECRET_DB_JUMP_BOX_HOST=\"$SECRET_DB_JUMP_BOX_HOST\"")
78+
fi
79+
80+
if [[ ${SECRET_DB_JUMP_BOX_USER+nothing} ]]; then
81+
args+=("-DSECRET_DB_JUMP_BOX_USER=\"$SECRET_DB_JUMP_BOX_USER\"")
82+
fi
83+
84+
if [[ ${SECRET_DB_JUMP_BOX_PRIVATE_KEY+nothing} ]]; then
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)