Skip to content

Add Version increment automation task#32

Merged
AmiStrn merged 4 commits intoopensearch-project:mainfrom
prudhvigodithi:main
Jul 13, 2022
Merged

Add Version increment automation task#32
AmiStrn merged 4 commits intoopensearch-project:mainfrom
prudhvigodithi:main

Conversation

@prudhvigodithi
Copy link
Copy Markdown
Member

@prudhvigodithi prudhvigodithi commented Jul 12, 2022

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.

Signed-off-by: pgodithi <pgodithi@amazon.com>
Copy link
Copy Markdown
Collaborator

@AmiStrn AmiStrn left a comment

Choose a reason for hiding this comment

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

Please fix the spelling in the comments:/

Copy link
Copy Markdown
Collaborator

@AmiStrn AmiStrn left a comment

Choose a reason for hiding this comment

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

I believe the function name should either change or you could change the logic to get the latest version. Thanks:)

build.gradle Outdated
Comment on lines +114 to +123
// 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)
}
}
Copy link
Copy Markdown
Collaborator

@AmiStrn AmiStrn Jul 12, 2022

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

More like setVersion?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Member Author

@prudhvigodithi prudhvigodithi Jul 12, 2022

Choose a reason for hiding this comment

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

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.

@prudhvigodithi prudhvigodithi requested a review from AmiStrn July 12, 2022 14:10
Signed-off-by: pgodithi <pgodithi@amazon.com>
Copy link
Copy Markdown
Collaborator

@AmiStrn AmiStrn left a comment

Choose a reason for hiding this comment

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

Spelling

Signed-off-by: pgodithi <pgodithi@amazon.com>
Signed-off-by: pgodithi <pgodithi@amazon.com>
@prudhvigodithi prudhvigodithi requested a review from AmiStrn July 12, 2022 16:31
@prudhvigodithi
Copy link
Copy Markdown
Member Author

prudhvigodithi commented Jul 12, 2022

Hello @dblock @AmiStrn @bbarani , if you are good with updateVersion?
I will go ahead an update across other PR's opensearch-project/opensearch-build#1375 (comment) that I have raised for each repo.
Thank you

Copy link
Copy Markdown
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Ok by me, @AmiStrn ?

Copy link
Copy Markdown
Collaborator

@AmiStrn AmiStrn left a comment

Choose a reason for hiding this comment

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

Lgtm:)

@AmiStrn AmiStrn merged commit d18ea9a into opensearch-project:main Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants