Skip to content

Commit bee35ac

Browse files
authored
buildkite: update references to the new env variables that are masked (#208)
1 parent d2b5158 commit bee35ac

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

.buildkite/hooks/pre-command

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
set -eo pipefail
1010

11-
echo "--- Prepare vault context"
11+
echo "--- Prepare vault context :vault:"
1212
VAULT_ROLE_ID_SECRET=$(vault read -field=role-id secret/ci/elastic-ecs-logging-java/internal-ci-approle)
1313
export VAULT_ROLE_ID_SECRET
1414

@@ -23,10 +23,7 @@ PREVIOUS_VAULT_TOKEN=$VAULT_TOKEN
2323
export PREVIOUS_VAULT_TOKEN
2424
unset VAULT_TOKEN
2525

26-
echo "--- Prepare keys context"
27-
VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID_SECRET" secret_id="$VAULT_SECRET_ID_SECRET")
28-
export VAULT_TOKEN
29-
26+
echo "--- Prepare a secure temp :closed_lock_with_key:"
3027
# Prepare a secure temp folder not shared between other jobs to store the key ring
3128
export TMP_WORKSPACE=/tmp/secured
3229
export KEY_FILE=$TMP_WORKSPACE"/private.key"
@@ -36,6 +33,16 @@ export GNUPGHOME=$TMP_WORKSPACE"/keyring"
3633
mkdir -p $GNUPGHOME
3734
chmod -R 700 $TMP_WORKSPACE
3835

36+
echo "--- Prepare keys context :key:"
37+
VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID_SECRET" secret_id="$VAULT_SECRET_ID_SECRET")
38+
export VAULT_TOKEN
39+
40+
# Nexus credentials
41+
SERVER_USERNAME=$(vault read -field username secret/release/nexus)
42+
export SERVER_USERNAME
43+
SERVER_PASSWORD=$(vault read -field password secret/release/nexus)
44+
export SERVER_PASSWORD
45+
3946
# Signing keys
4047
vault read -field=key secret/release/signing >$KEY_FILE
4148
KEYPASS_SECRET=$(vault read -field=passphrase secret/release/signing)
@@ -45,11 +52,7 @@ export KEY_ID_SECRET=D88E42B4
4552
# Import the key into the keyring
4653
echo "$KEYPASS_SECRET" | gpg --batch --import "$KEY_FILE"
4754

48-
# Export secring
49-
export SECRING_FILE=$GNUPGHOME"/secring.gpg"
50-
gpg --pinentry-mode=loopback --passphrase "$KEYPASS_SECRET" --export-secret-key $KEY_ID_SECRET > "$SECRING_FILE"
51-
52-
echo "--- Configure git context"
55+
echo "--- Configure git context :git:"
5356
# Configure the committer since the maven release requires to push changes to GitHub
5457
# This will help with the SLSA requirements.
5558
git config --global user.email "[email protected]"
@@ -65,4 +68,3 @@ tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components
6568

6669
export JAVA_HOME
6770
export PATH=$JAVA_HOME/bin:$PATH
68-

.ci/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trap clean_up EXIT
2222
git checkout -f "${branch_specifier}"
2323

2424
set +x
25-
echo "--- Release the binaries to Maven Central"
25+
echo "--- Release the binaries to Maven Central :maven:"
2626
if [[ "$dry_run" == "true" ]] ; then
2727
echo './mvnw release:prepare release:perform --settings .ci/settings.xml --batch-mode'
2828
else

.ci/settings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
<activeByDefault>true</activeByDefault>
2323
</activation>
2424
<properties>
25-
<gpg.passphrase>${env.KEYPASS}</gpg.passphrase>
25+
<!-- this env variable is defined in .buildkite/hooks/pre-command -->
26+
<gpg.passphrase>${env.KEYPASS_SECRET}</gpg.passphrase>
2627
</properties>
2728
</profile>
2829
</profiles>

.ci/snapshot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ clean_up () {
1919
trap clean_up EXIT
2020

2121
set +x
22-
echo "--- Deploy the snapshot"
22+
echo "--- Deploy the snapshot :package:"
2323
if [[ "$dry_run" == "true" ]] ; then
2424
echo './mvnw -s .ci/settings.xml -Pgpg clean deploy --batch-mode'
2525
else

0 commit comments

Comments
 (0)