Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Aug 17, 2023
1 parent 4fddf34 commit 22dcf81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ PATH="${PATH}:$GOPATH:$GOPATH/bin"
export PATH

echo "--- Prepare vault context :vault:"
#CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
#DRA_CREDS_SECRET=$(retry 5 vault kv get -field=data -format=json ${CI_DRA_ROLE_PATH})
#VAULT_ADDR_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.vault_addr')
#VAULT_ROLE_ID_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.role_id')
#VAULT_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.secret_id')
#export VAULT_ADDR_SECRET VAULT_ROLE_ID_SECRET VAULT_SECRET
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
DRA_CREDS_SECRET=$(retry 5 vault kv get -field=data -format=json ${CI_DRA_ROLE_PATH})
VAULT_ADDR_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.vault_addr')
VAULT_ROLE_ID_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.role_id')
VAULT_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.secret_id')
export VAULT_ADDR_SECRET VAULT_ROLE_ID_SECRET VAULT_SECRET
12 changes: 9 additions & 3 deletions .buildkite/scripts/dra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ ls -l build/

if [[ "${BUILDKITE_PULL_REQUEST:-false}" == "false" ]]; then
echo "--- :arrow_right: Release Manager does not run on PRs, skipping"
exit 0
# TODO: for testing purposes
#exit 0
fi

curl -s https://storage.googleapis.com/artifacts-api/snapshots/branches.json > active-branches.json
Expand All @@ -35,12 +36,15 @@ if ! grep -q "\"$BUILDKITE_BRANCH\"" active-branches.json ; then
echo "VERSION=$VERSION"
echo "Supported branches:"
cat active-branches.json
exit 0
# TODO: for testing purposes
#exit 0
fi

dra() {
local workflow=$1
echo "--- Run release manager $workflow"
# TODO: for testing purposes let's force the branch
BUILDKITE_BRANCH=main
docker run --rm \
--name release-manager \
-e VAULT_ADDR="${VAULT_ADDR_SECRET}" \
Expand All @@ -54,7 +58,9 @@ dra() {
--commit $BUILDKITE_COMMIT \
--workflow $workflow \
--artifact-set main \
--version $VERSION
--version $VERSION \
--dry-run
## TODO: for testing purposes it uses --dry-run
}

dra "snapshot"
Expand Down

0 comments on commit 22dcf81

Please sign in to comment.