Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Mar 18, 2025

Release notes

[rn: skip]

What does this PR do?

Adds a shareable script for buildkite to get a fully-qualified version, including:

  • the base version from ${LOGSTASH_HOME}/versions.yml
  • the qualifier from optional VERSION_QUALIFIER environment variable
  • the SNAPSHOT tag from either WORKFLOW_TYPE or RELEASE environment variables

Why is it important/What is the impact to the user?

In #17298 we are adding tasks to smoke-test built artifacts, so we need the qualified version. Instead of duplicating the logic yet again, I extracted it to a share-able helper. I plan to backport this and reuse it elsewhere.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

Sourcing sets the QUALIFIED_VERSION environment variable

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (source .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION))
QUALIFIED_VERSION=9.1.0-SNAPSHOT
[success]

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (RELEASE=1 source .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION))
QUALIFIED_VERSION=9.1.0
[success]

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (WORKFLOW_TYPE=staging source .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION)) 
QUALIFIED_VERSION=9.1.0
[success]

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (VERSION_QUALIFIER=beta1 WORKFLOW_TYPE=staging source .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION))
QUALIFIED_VERSION=9.1.0-beta1
[success]

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (VERSION_QUALIFIER=beta1 source .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION)) 
QUALIFIED_VERSION=9.1.0-beta1-SNAPSHOT
[success]

Invoking outputs the qualified version, but doesn't set the env var (the % is my shell's way of saying that there was no trailing newline, and the commands "error" because the grep fails to find QUALIFIED_VERSION in the output of env ):

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (.buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION))                 
9.1.0-SNAPSHOT%
[error: 1]    

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (RELEASE=1 .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION))
9.1.0%[error: 1]

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (WORKFLOW_TYPE=staging .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION))
9.1.0%
[error: 1]

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (VERSION_QUALIFIER=beta1 WORKFLOW_TYPE=staging .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION))
9.1.0-beta1%
[error: 1] 

╭─{ rye@perhaps:~/src/elastic/logstash@main (build-script-qualified-version ✔) }
╰─● (VERSION_QUALIFIER=beta1 .buildkite/scripts/common/qualified-version.sh; (env | grep QUALIFIED_VERSION)) 
9.1.0-beta1-SNAPSHOT%
[error: 1]
~~~<hr>This is an automatic backport of pull request #17311 done by [Mergify](https://mergify.com).

* ci: add shareable script for generating qualified version

* ci: use shared script to generate qualified version

(cherry picked from commit 10b5a84)

# Conflicts:
#	.buildkite/scripts/dra/build_docker.sh
@mergify mergify bot added backport conflicts Detected git conflicts labels Mar 18, 2025
@mergify mergify bot assigned yaauie Mar 18, 2025
@mergify
Copy link
Contributor Author

mergify bot commented Mar 18, 2025

Cherry-pick of 10b5a84 has failed:

On branch mergify/bp/8.18/pr-17311
Your branch is up to date with 'origin/8.18'.

You are currently cherry-picking commit 10b5a84f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   .buildkite/scripts/common/qualified-version.sh
	modified:   .buildkite/scripts/dra/build_packages.sh
	modified:   .buildkite/scripts/dra/common.sh
	modified:   .buildkite/scripts/dra/publish.sh

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   .buildkite/scripts/dra/build_docker.sh

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@elastic-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @yaauie

Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

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

The merge was not clean because lines immediately above an applied hunk had changed; the merge was resolved manually and the build is green.

@yaauie yaauie merged commit 45fa28a into 8.18 Mar 19, 2025
7 checks passed
@yaauie yaauie deleted the mergify/bp/8.18/pr-17311 branch March 19, 2025 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts Detected git conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants