Add Version increment automation task#32
Conversation
Signed-off-by: pgodithi <pgodithi@amazon.com>
AmiStrn
left a comment
There was a problem hiding this comment.
Please fix the spelling in the comments:/
AmiStrn
left a comment
There was a problem hiding this comment.
I believe the function name should either change or you could change the logic to get the latest version. Thanks:)
build.gradle
Outdated
| // versionIncrement: Task to auto increment to the next development iteration | ||
| task versionIncrement { | ||
| onlyIf { System.getProperty('newVersion') } | ||
| doLast { | ||
| ext.newVersion = System.getProperty('newVersion') | ||
| println "Setting version to ${newVersion}." | ||
| // String tokenization to support -SNAPSHOT | ||
| ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) | ||
| } | ||
| } |
There was a problem hiding this comment.
Is there a way you can make it so we dont need to explicitly declare the version? currently this solution is not "versionIncrement" it is actually a "versionChange" function.
Either validate that we are actually incrementing or perhaps getting the latest version and changing the code to reflect that.
There was a problem hiding this comment.
Hey @AmiStrn the expectation from this task is to make sure the required files are updated for plugins with a new version and auto raises a PR, instead requiring a manual PR to open. The comparison of the version is with OpenSearch Core and update the required files, so the validation comes by comparing against Core repo, I have added this task to the template to make sure the upcoming plugins do have this task and from automation end, we can just trigger this task globally for all plugins ./gradlew versionIncrement -DnewVersion=2.2.0-SNAPSHOT which will auto raise a version increment PR to allow plugin teams to validate and merge.
@dblock @bbarani
There was a problem hiding this comment.
@prudhvigodithi All @AmiStrn is saying is that the task does one thing (set a version), but is used differently (increment the version). You should name the task to match what it does, not how it's used.
There was a problem hiding this comment.
True, my point is, the task updates the version (higher than the current one) to all the desired files, hence the name versionIncrement should be justified, setVersion can be used something like to set the version property. Again I'm open for a change.
There was a problem hiding this comment.
Im sorry i was not clear.
The issue is precisely what @dblock understood.
You can potentially set to version 1.0 right? so it is not "increment", setVersion would be more adequate, maybe updateVersion?
There was a problem hiding this comment.
Thanks @AmiStrn,
The idea is to call this task via workflow, the workflow only compares with OpenSearch and updates the version, so it would be an increment as OpenSearch core version would be always ahead and with existing setup based on OpenSearch version plugins version is inferred. I'm good with updateVersion.
Signed-off-by: pgodithi <pgodithi@amazon.com>
Signed-off-by: pgodithi <pgodithi@amazon.com>
Signed-off-by: pgodithi <pgodithi@amazon.com>
|
Hello @dblock @AmiStrn @bbarani , if you are good with |
Signed-off-by: pgodithi pgodithi@amazon.com
Description
Gradle project: Add gradle task (versionIncrement) that support version increment automation.
Issues Resolved
Part of: opensearch-project/opensearch-build#1375
From solution: opensearch-project/opensearch-build#1375 (comment)
Related issue: opensearch-project/opensearch-plugins#155
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.