[CI] Use the same commit from target branch for all steps in post-checkout hook#10397
Merged
Conversation
271d573 to
03eb6e3
Compare
03eb6e3 to
06aea19
Compare
dliappis
reviewed
Jul 5, 2024
dliappis
left a comment
There was a problem hiding this comment.
Make sense. Left a couple of suggestions.
| git fetch -v origin "${target_branch}" | ||
| git checkout FETCH_HEAD | ||
| echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" | ||
| if [[ ${REPOSITORY_TARGET_BRANCH_COMMIT} == "" ]]; then |
There was a problem hiding this comment.
As discussed offline I'd suggest that we add a big fat warning at the top of this file like
# ******************************* WARNING *******************************
# This post-checkout hook is not the same as in the rest of repos e.g. beats
# because some steps in this pipeline (in PR context) take a very long time
# and we want to make sure that THE SAME COMMIT FROM TARGET BRANCH
# gets merged in every pipeline step. Otherwise, HEAD may have changed in the meantime
# and therefore, some steps (e.g. sonarqube) may end up testing a different commit
# *************************************************************************
Co-authored-by: Dimitrios Liappis <dimitrios.liappis@gmail.com>
⏳ Build in-progress, with failures
Failed CI Steps
History
cc @mrodm |
🚀 Benchmarks reportTo see the full report comment with |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Proposed commit message
Use the same commit (SHA changeset) from the target branch, e.g. main branch, for all steps run in the Buildkite pipeline in the context of Pull Requests. This commit from main will be used in the
post-checkouthook when available. Using the same changeset from the target branch in all steps avoids that some steps could be using a newer commit from the target branch if a new PR is merged during the build is running. That would create a different merge branch in the post-checkout hook with different contents.For instance in this build, sonar step runs a different changeset than previous steps:
https://buildkite.com/elastic/integrations/builds/13288
Looking into that build, it can be observed how two different steps are using different changesets from main (there was a PR merged while the PR was being tested) to generate the temporal branch in the
post-checkouthook:Related issues