-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Add pull request job to verify transport versions backported via main #134568
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
Merged
mark-vieira
merged 9 commits into
elastic:9.0
from
mark-vieira:transport-version-backport-validation
Sep 12, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
97266a1
Add pull request job to verify transport versions backported via main
mark-vieira bfb97cf
Fix path to script
mark-vieira 34a5324
Make sure we fetch main before comparing
mark-vieira cc86271
Print file diff when change is detected
mark-vieira 249b64e
Add a new transport version to test failure
mark-vieira 4afe57b
Remove --quiet
mark-vieira 1d640b2
Revert "Add a new transport version to test failure"
mark-vieira 83d0f8e
Remove diff
mark-vieira 9021221
Merge branch '9.0' into transport-version-backport-validation
mark-vieira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
.buildkite/pipelines/pull-request/validate-transport-version-backport.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
config: | ||
skip-target-branches: "main" | ||
steps: | ||
- label: validate-transport-version-backport | ||
command: .buildkite/scripts/validate-transport-version-backport.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
echo "--- Looking for transport version changes" | ||
|
||
# Get any changes in this pull request to transport definitions | ||
git fetch origin "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" --quiet | ||
changed_files=$(git diff --name-only "origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" | grep -E "server/src/main/resources/transport/definitions/.*\.csv" || true) | ||
|
||
if [[ -z "${changed_files}" ]]; then | ||
echo "No transport version changes detected." | ||
exit 0 | ||
fi | ||
|
||
# Compare those files against the main branch to ensure they are the same | ||
git fetch origin main --quiet | ||
while IFS= read -r file; do | ||
if ! git diff --quiet origin/main -- "${file}"; then | ||
echo "Changes to transport definition [${file}] missing from main branch." | ||
echo "Transport changes must first be merged to main before being backported." | ||
mark-vieira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
exit 1 | ||
fi | ||
done <<< "${changed_files}" | ||
|
||
echo "All transport changes exist in main branch." |
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.
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.
what does the "or true" do? Won't that make
changed_files
a boolean instead of a string list of changes?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.
the
|| true
just ensures we always return a 0 exit code from that command since we have setpipefail
. Otherwise ifgrep
doesn't return any matches, we'll exit with a non-zero exit code, failing the job, which isn't what we want.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.
To further clarify, the
true
utility doesn't produce any output. It simply always returns a 0 exit code. So in that scenariochanged_files
is still an empty string if there are no matches.