From 17ed0748e8d7671df31291d7b2bce5460c74b0f5 Mon Sep 17 00:00:00 2001 From: Brad White Date: Wed, 22 Nov 2023 15:12:33 -0700 Subject: [PATCH] fix/redact axios headers (#171803) Fix token things --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .buildkite/pipeline-utils/ci-stats/client.ts | 4 ++-- .buildkite/scripts/lifecycle/pre_build.sh | 2 -- .buildkite/scripts/lifecycle/pre_command.sh | 12 ++++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.buildkite/pipeline-utils/ci-stats/client.ts b/.buildkite/pipeline-utils/ci-stats/client.ts index 6a5c048464c70..d7367b89947ad 100644 --- a/.buildkite/pipeline-utils/ci-stats/client.ts +++ b/.buildkite/pipeline-utils/ci-stats/client.ts @@ -201,7 +201,7 @@ export class CiStatsClient { headers: this.defaultHeaders, }); } catch (error) { - console.error('CI Stats request error:', error); + console.error('CI Stats request error:', error?.response?.data?.message); if (attempt < maxAttempts) { const sec = attempt * 3; @@ -210,7 +210,7 @@ export class CiStatsClient { continue; } - throw error; + throw new Error('Failed to connect to CI Stats.'); } } } diff --git a/.buildkite/scripts/lifecycle/pre_build.sh b/.buildkite/scripts/lifecycle/pre_build.sh index 62f94dd493fa8..b8ccaf04f9bb9 100755 --- a/.buildkite/scripts/lifecycle/pre_build.sh +++ b/.buildkite/scripts/lifecycle/pre_build.sh @@ -8,8 +8,6 @@ if [[ "${GITHUB_BUILD_COMMIT_STATUS_ENABLED:-}" != "true" ]]; then "$(dirname "${0}")/commit_status_start.sh" fi -export CI_STATS_TOKEN="$(retry 5 5 vault read -field=api_token secret/kibana-issues/dev/kibana_ci_stats)" -export CI_STATS_HOST="$(retry 5 5 vault read -field=api_host secret/kibana-issues/dev/kibana_ci_stats)" ts-node "$(dirname "${0}")/ci_stats_start.ts" diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index 9cfa973b28024..965c09621caa0 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -77,16 +77,16 @@ EOF { CI_STATS_BUILD_ID="$(buildkite-agent meta-data get ci_stats_build_id --default '')" export CI_STATS_BUILD_ID + + CI_STATS_TOKEN="$(retry 5 5 vault read -field=api_token secret/kibana-issues/dev/kibana_ci_stats)" + export CI_STATS_TOKEN + + CI_STATS_HOST="$(retry 5 5 vault read -field=api_host secret/kibana-issues/dev/kibana_ci_stats)" + export CI_STATS_HOST if [[ "$CI_STATS_BUILD_ID" ]]; then echo "CI Stats Build ID: $CI_STATS_BUILD_ID" - CI_STATS_TOKEN="$(retry 5 5 vault read -field=api_token secret/kibana-issues/dev/kibana_ci_stats)" - export CI_STATS_TOKEN - - CI_STATS_HOST="$(retry 5 5 vault read -field=api_host secret/kibana-issues/dev/kibana_ci_stats)" - export CI_STATS_HOST - KIBANA_CI_STATS_CONFIG=$(jq -n \ --arg buildId "$CI_STATS_BUILD_ID" \ --arg apiUrl "https://$CI_STATS_HOST" \