-
Notifications
You must be signed in to change notification settings - Fork 144
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
Clarify purpose of .agent-versions
file
#5522
Clarify purpose of .agent-versions
file
#5522
Conversation
This pull request does not have a backport label. Could you fix it @ycombinator? 🙏
|
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
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.
LGTM
@@ -22,7 +22,7 @@ else | |||
git add .agent-versions.json .package-version | |||
|
|||
nl=$'\n' # otherwise the new line character is not recognized properly | |||
commit_desc="These files are used for picking agent versions in integration tests.${nl}${nl}The content is based on responses from https://www.elastic.co/api/product_versions and https://snapshots.elastic.co${nl}${nl}The current update is generated based on the following requirements:${nl}${nl}Package version: ${package_version}${nl}${nl}\`\`\`json${nl}${version_requirements}${nl}\`\`\`" | |||
commit_desc="These files are used for picking the starting (pre-upgrade) agent versions in upgrade integration tests.${nl}${nl}The content is based on responses from https://www.elastic.co/api/product_versions and https://snapshots.elastic.co${nl}${nl}The current update is generated based on the following requirements:${nl}${nl}Package version: ${package_version}${nl}${nl}\`\`\`json${nl}${version_requirements}${nl}\`\`\`" |
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.
This is not entirely true, the upgrade tests run both directions and these versions are not used in just upgrade tests.
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.
Thanks, I see now that the versions from this file are not just used as starting versions in the upgrade test. For example, TestStandaloneUpgradeRetryDownload
calls upgradetest.PreviousMinor()
to set the end version and that function ends up looking at the versions from the file. So I will fix the text in this PR accordingly.
But I'm not seeing where the versions from this file are being used outside of upgrade tests. Could you point me to an example?
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.
@ycombinator yes, I meant the usage of upgradetest.PreviousMinor()
in other tests, there is a few of them https://github.com/search?q=repo%3Aelastic%2Felastic-agent%20upgradetest.PreviousMinor()&type=code
Since this file is only used for tests, can we move it to the |
I'm a +1 to this idea. The generic name of the file and it's current location has confused me in the past, which is part of the reason I raised this PR to switch to YAML so we could at least add comments in the file. Other reviewers (@rdner @pchila @AndersonQ @blakerouse @cmacknz), any objections to this move? I'll make sure that everyone on the team is aware of it, in case they go looking for the file. |
If we are discussing moving files, .agent-versions should live under In any case I am in favor of moving the file away from the repo root and/or renaming. 👍 |
I'm fine with moving the file. It might require changes in the automation code here https://github.com/elastic/elastic-agent/blob/main/.github/workflows/bump-agent-versions.sh |
@ycombinator actually this script requires changes even for this original PR here
I missed that 🙂 |
Based on the discussion, I've moved the |
51db753
to
a47ffb2
Compare
@@ -0,0 +1,12 @@ | |||
# This file is generated automatically. Please do not manually edit it. |
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.
We do manually edit this occasionally when we need to temporarily block a version because of a bug, but in general that is the exception.
a47ffb2
to
b196b17
Compare
Quality Gate passedIssues Measures |
* Clarify commit message * Convert file to YML and add header comment * Reintroducing rand/v2 import cleaned up by IDE * Use YAML v3 * Replace .agent-versions.json with .agent-versions.yml * Running mage fmt * Adding a newline in the header comment * Fix comment * Fix commit message * Look for changes in new file * Moving + renaming agent versions file * Updating code to refer to new file location + name * Running mage integration:updateVersions (cherry picked from commit 2feeb36) # Conflicts: # .agent-versions.json
* Clarify commit message * Convert file to YML and add header comment * Reintroducing rand/v2 import cleaned up by IDE * Use YAML v3 * Replace .agent-versions.json with .agent-versions.yml * Running mage fmt * Adding a newline in the header comment * Fix comment * Fix commit message * Look for changes in new file * Moving + renaming agent versions file * Updating code to refer to new file location + name * Running mage integration:updateVersions (cherry picked from commit 2feeb36) # Conflicts: # .agent-versions.json
* Clarify commit message * Convert file to YML and add header comment * Reintroducing rand/v2 import cleaned up by IDE * Use YAML v3 * Replace .agent-versions.json with .agent-versions.yml * Running mage fmt * Adding a newline in the header comment * Fix comment * Fix commit message * Look for changes in new file * Moving + renaming agent versions file * Updating code to refer to new file location + name * Running mage integration:updateVersions (cherry picked from commit 2feeb36) # Conflicts: # .agent-versions.json Co-authored-by: Shaunak Kashyap <[email protected]>
* Clarify commit message * Convert file to YML and add header comment * Reintroducing rand/v2 import cleaned up by IDE * Use YAML v3 * Replace .agent-versions.json with .agent-versions.yml * Running mage fmt * Adding a newline in the header comment * Fix comment * Fix commit message * Look for changes in new file * Moving + renaming agent versions file * Updating code to refer to new file location + name * Running mage integration:updateVersions
What does this PR do?
This PR clarifies the purpose of the
.agent-versions
file. It does so by making the following changes:.agent-versions.json
totesting/integration/testdata/.upgrade-test-agent-versions.yml
and adjust the contents to match. The reason for using YAML is so we can add a header comment about the contents of the file in the file itself.Before this PR
Before this PR, we had an
.agent-versions.json
file and it looked like this:After this PR
After this PR, we instead have an
testing/integration/testdata/.upgrade-test-agent-versions.yml
file and it looks like this:Why is it important?
To make it easier to understand the purpose of the
.agent-versions
file and to prevent accidental manual edits to it.How to test this PR locally
testing/integration/testdata/.upgrade-test-agent-versions.yml
file.integration:updateVersions
.testing/integration/testdata/.upgrade-test-agent-versions.yml
file is updated with the expected contents.