[8.x](backport #5610) Handle BUILDKITE_MESSAGE length in pre-command.ps1 #5632
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.
Description of problem:
Windows unit test pre-command steps were failing in CI when the BUILDKITE_MESSAGE param was too long, which would occur when commits had very long descriptions. This sometimes happens from automated processes, such as dependency updates. The BUILDKITE_MESSAGE would be very long, which would fill the Windows env var buffer, preventing further pre-command steps from adding directories to the PATH.
Problem report: https://elastic.slack.com/archives/C0522G6FBNE/p1727193548224399
Fix:
Trim the BUILDKITE_MESSAGE param to the INTERNET_MAX_URL_LENGTH of 2048.
This was tested in draft PR #5609 with very long and short commit messages. I confirmed that the Windows unit test steps got past the pre-command phase.
References:
This is an automatic backport of pull request Handle BUILDKITE_MESSAGE length in pre-command.ps1 #5610 done by Mergify.