Skip to content

Commit

Permalink
buildkite: skip clone for GitHub check notifications (#3106)
Browse files Browse the repository at this point in the history
* buildkite: skip clone for GitHub check notifications

* fix

* fix

* use dollar to support bash commands or env variables at runtime

* try something else

* test

* remove test
  • Loading branch information
v1v authored Nov 8, 2024
1 parent 6aef2b9 commit 6361051
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 38 deletions.
28 changes: 23 additions & 5 deletions .buildkite/build_pr_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ steps:
command: ".buildkite/scripts/cancel_running_pr.sh || true"
- key: "build-pr-setup"
label: "setup"
command: ".buildkite/scripts/build_pr_commit_status.sh pending"
command: |
curl -s -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $${VAULT_GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${GITHUB_PR_BASE_OWNER}/${GITHUB_PR_BASE_REPO}/statuses/${GITHUB_PR_TRIGGERED_SHA}" \
-d '{"state":"pending","target_url":"'$BUILDKITE_BUILD_URL'","description":"Build started","context":"buildkite/'$BUILDKITE_PIPELINE_SLUG'"}'
plugins:
- 'uber-workflow/run-without-clone':
- key: "build-pr"
label: ":hammer: Build docs PR"
command: ".buildkite/scripts/build_pr.sh"
Expand All @@ -21,11 +30,20 @@ steps:
- key: "teardown"
label: "teardown"
command: |
if [ $(buildkite-agent step get "outcome" --step "build-pr") == "passed" ]; then
.buildkite/scripts/build_pr_commit_status.sh success
else
.buildkite/scripts/build_pr_commit_status.sh failure
status_state=failure
if [ $$(buildkite-agent step get "outcome" --step "build-pr") == "passed" ]; then
status_state=success
fi
export status_state
curl -s -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $${VAULT_GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${GITHUB_PR_BASE_OWNER}/${GITHUB_PR_BASE_REPO}/statuses/${GITHUB_PR_TRIGGERED_SHA}" \
-d '{"state":"'$$status_state'","target_url":"'$BUILDKITE_BUILD_URL'","description":"Build finished","context":"buildkite/'$BUILDKITE_PIPELINE_SLUG'"}'
depends_on:
- step: "build-pr"
allow_failure: true
plugins:
- 'uber-workflow/run-without-clone':
33 changes: 0 additions & 33 deletions .buildkite/scripts/build_pr_commit_status.sh

This file was deleted.

0 comments on commit 6361051

Please sign in to comment.