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)
@mergify mergify bot added the backport label Mar 18, 2025
@mergify mergify bot assigned yaauie Mar 18, 2025
@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

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.

✅ Clean and Green 🎉

@yaauie yaauie merged commit 7e53175 into 9.0 Mar 18, 2025
7 checks passed
@yaauie yaauie deleted the mergify/bp/9.0/pr-17311 branch March 18, 2025 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants