From a138c418e853294b875950bc4537dee560ae4f2e Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Wed, 15 May 2024 19:55:08 +0200 Subject: [PATCH] [7.17] [CI] Fix issues related to publish (#183393) (#183547) # Backport This will backport the following commits from `main` to `7.17`: - [[CI] Fix issues related to publish (#183393)](https://github.com/elastic/kibana/pull/183393) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .buildkite/scripts/common/vault_fns.sh | 20 +++++++++++++++++++ .buildkite/scripts/steps/artifacts/publish.sh | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/common/vault_fns.sh b/.buildkite/scripts/common/vault_fns.sh index a7b92a4b05d6d..022a22541d6bf 100644 --- a/.buildkite/scripts/common/vault_fns.sh +++ b/.buildkite/scripts/common/vault_fns.sh @@ -65,3 +65,23 @@ vault_kv_set() { vault kv put "$VAULT_KV_PREFIX/$kv_path" "${fields[@]}" } + +function get_vault_role_id() { + if [[ "$IS_LEGACY_VAULT_ADDR" == "true" ]]; then + VAULT_ROLE_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-role-id)" + else + VAULT_ROLE_ID="$(vault_get kibana-buildkite-vault-credentials role-id)" + fi + + echo "$VAULT_ROLE_ID" +} + +function get_vault_secret_id() { + if [[ "$IS_LEGACY_VAULT_ADDR" == "true" ]]; then + VAULT_SECRET_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-secret-id)" + else + VAULT_SECRET_ID="$(vault_get kibana-buildkite-vault-credentials secret-id)" + fi + + echo "$VAULT_SECRET_ID" +} diff --git a/.buildkite/scripts/steps/artifacts/publish.sh b/.buildkite/scripts/steps/artifacts/publish.sh index 6e8a9ed2bb47d..36b1ccacfd016 100644 --- a/.buildkite/scripts/steps/artifacts/publish.sh +++ b/.buildkite/scripts/steps/artifacts/publish.sh @@ -50,8 +50,8 @@ docker pull docker.elastic.co/infra/release-manager:latest echo "--- Publish artifacts" if [[ "$BUILDKITE_BRANCH" == "$KIBANA_BASE_BRANCH" ]]; then - export VAULT_ROLE_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-role-id)" - export VAULT_SECRET_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-secret-id)" + export VAULT_ROLE_ID="$(get_vault_role_id)" + export VAULT_SECRET_ID="$(get_vault_secret_id)" export VAULT_ADDR="https://secrets.elastic.co:8200" docker run --rm \ --name release-manager \