-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildkite: skip clone for GitHub check notifications #3106
Changes from all commits
db60c40
6f155c6
b9ca7fa
9c29cb4
e43526e
4a7b43b
6ff59a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
@@ -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 | ||
Comment on lines
-24
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just out of curiosity, is there a performance reason for changing this logic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, these 2 steps take about ~ 25 seconds each, and that's only to notify the status in the GitHub PRs using GH checks. I came up with this after discussing different areas of improvement in https://github.com/elastic/observability-robots/issues/2408 In a nutshell, Buildkite does not allow to skip the checkout or speed up the checkout out of the box. In this case, I decided to remove the script from the repository and use the content in the Buildkite pipeline - by doing so, those 2 steps don't need the cloned repository. However, if this complicates things, we can keep it as is. |
||
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': |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid interpolation and therefore exposing credentials
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an interesting read in Slack