88
99set -eo pipefail
1010
11- echo " --- Prepare vault context"
11+ echo " --- Prepare vault context :vault: "
1212VAULT_ROLE_ID_SECRET=$( vault read -field=role-id secret/ci/elastic-ecs-logging-java/internal-ci-approle)
1313export VAULT_ROLE_ID_SECRET
1414
@@ -23,10 +23,7 @@ PREVIOUS_VAULT_TOKEN=$VAULT_TOKEN
2323export PREVIOUS_VAULT_TOKEN
2424unset 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
3128export TMP_WORKSPACE=/tmp/secured
3229export KEY_FILE=$TMP_WORKSPACE " /private.key"
@@ -36,6 +33,16 @@ export GNUPGHOME=$TMP_WORKSPACE"/keyring"
3633mkdir -p $GNUPGHOME
3734chmod -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
4047vault read -field=key secret/release/signing > $KEY_FILE
4148KEYPASS_SECRET=$( vault read -field=passphrase secret/release/signing)
@@ -45,11 +52,7 @@ export KEY_ID_SECRET=D88E42B4
4552# Import the key into the keyring
4653echo " $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.
5558git config --global user.email " infra-root+apmmachine@elastic.co"
@@ -65,4 +68,3 @@ tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components
6568
6669export JAVA_HOME
6770export PATH=$JAVA_HOME /bin:$PATH
68-
0 commit comments