Skip to content

Commit afcda7a

Browse files
authored
bk: use a buildkite plugin and be declarative (#14408)
1 parent 77a4ec5 commit afcda7a

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

.buildkite/hooks/pre-command

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ if [[ "${BUILDKITE_PIPELINE_SLUG}" =~ ^(integrations|integrations-test-stack)$ ]
100100
if [[ "${BUILDKITE_STEP_KEY}" == "publish-benchmarks" ]]; then
101101
BUILDKITE_API_TOKEN=$(retry 5 vault kv get -field buildkite_token "${BUILDKITE_API_TOKEN_PATH}")
102102
export BUILDKITE_API_TOKEN
103-
GITHUB_TOKEN=$VAULT_GITHUB_TOKEN
104-
export GITHUB_TOKEN
105103
fi
106104

107105
if [[ "${BUILDKITE_STEP_KEY}" =~ ^test-integrations- ]]; then
@@ -120,19 +118,3 @@ if [[ "${BUILDKITE_PIPELINE_SLUG}" == "integrations-serverless" ]]; then
120118
export EC_REGION_SECRET
121119
fi
122120
fi
123-
124-
if [[ "$BUILDKITE_PIPELINE_SLUG" == "integrations-backport" ]]; then
125-
if [[ "$BUILDKITE_STEP_KEY" == "create-backport-branch" ]]; then
126-
GITHUB_USERNAME="elastic-vault-github-plugin-prod"
127-
GITHUB_EMAIL="elasticmachine@elastic.co"
128-
GITHUB_TOKEN=$VAULT_GITHUB_TOKEN
129-
export GITHUB_TOKEN GITHUB_EMAIL GITHUB_USERNAME
130-
fi
131-
fi
132-
133-
if [[ "$BUILDKITE_PIPELINE_SLUG" == "integrations" || "$BUILDKITE_PIPELINE_SLUG" == "integrations-serverless" ]]; then
134-
if [[ "$BUILDKITE_STEP_KEY" == "report-failed-tests" ]]; then
135-
export GITHUB_TOKEN="${VAULT_GITHUB_TOKEN}"
136-
fi
137-
fi
138-

.buildkite/pipeline.backport.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ steps:
5353
command: ".buildkite/scripts/backport_branch.sh"
5454
agents:
5555
image: "${LINUX_AGENT_IMAGE}"
56+
env:
57+
GITHUB_EMAIL: "elasticmachine@elastic.co"
58+
GITHUB_USERNAME: "elastic-vault-github-plugin-prod"
59+
plugins:
60+
- elastic/vault-github-token#v0.1.0:
5661
depends_on:
5762
- step: "input-variables"
5863
allow_failure: false

.buildkite/pipeline.serverless.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ steps:
110110
image: "${LINUX_AGENT_IMAGE}"
111111
cpu: "8"
112112
memory: "4G"
113+
plugins:
114+
- elastic/vault-github-token#v0.1.0:
113115
# not fail build if this step fails
114116
soft_fail: true
115117
# run this step when if it is triggered by the daily job

.buildkite/pipeline.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ steps:
7070
image: "${LINUX_AGENT_IMAGE}"
7171
cpu: "8"
7272
memory: "4G"
73+
plugins:
74+
- elastic/vault-github-token#v0.1.0:
7375
if: |
7476
build.env('BUILDKITE_PULL_REQUEST') != "false" &&
7577
build.env('BUILDKITE_PIPELINE_SLUG') == "integrations"
@@ -108,6 +110,8 @@ steps:
108110
image: "${LINUX_AGENT_IMAGE}"
109111
cpu: "8"
110112
memory: "4G"
113+
plugins:
114+
- elastic/vault-github-token#v0.1.0:
111115
# not fail build if this step fails
112116
soft_fail: true
113117
# run this step when if it is triggered by the daily job

0 commit comments

Comments
 (0)