Skip to content
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

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

v1v
Copy link
Member

@v1v v1v commented Nov 5, 2024

I copied the content of .buildkite/scripts/build_pr_commit_status.sh inside the Buildkite pipeline.
I enabled https://github.com/uber-workflow/run-without-clone-buildkite-plugin to avoid cloning for quick runs. See https://github.com/elastic/observability-robots/issues/2408#issuecomment-2456737659

The Preparing working directory won't do anything, hence I expect about 30 seconds faster builds.

image

Improvements

From

image

now

image

@v1v v1v requested a review from a team as a code owner November 5, 2024 14:52
Copy link

github-actions bot commented Nov 5, 2024

A documentation preview will be available soon.

Request a new doc build by commenting
  • Rebuild this PR: run docs-build
  • Rebuild this PR and all Elastic docs: run docs-build rebuild

run docs-build is much faster than run docs-build rebuild. A rebuild should only be needed in rare situations.

If your PR continues to fail for an unknown reason, the doc build pipeline may be broken. Elastic employees can check the pipeline status here.

@bmorelli25
Copy link
Member

@v1v Thanks! It looks like this has broken the status reporting for the ci check though. The ci check is still showing as "expected"

@v1v
Copy link
Member Author

v1v commented Nov 7, 2024

The ci check is still showing as "expected"

Thanks Brandon! I know now how to test this out :)

I'll fix it

@v1v v1v marked this pull request as draft November 7, 2024 17:31
@v1v v1v marked this pull request as ready for review November 7, 2024 21:10
@v1v
Copy link
Member Author

v1v commented Nov 7, 2024

@bmorelli25 , this is now working - took me a while until I passed my black belt with Buildkite 😭

curl -s -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $${VAULT_GITHUB_TOKEN}" \
Copy link
Member Author

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

Copy link
Member

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

Comment on lines -24 to +35
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
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

@bmorelli25 bmorelli25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Victor! I'll merge this at the start of my day tomorrow so that I can keep an eye on builds for a few hours to make sure everything is working as expected.

@bmorelli25 bmorelli25 merged commit 6361051 into master Nov 8, 2024
3 checks passed
@bmorelli25 bmorelli25 deleted the feature/speed-up-cloning branch November 8, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants