-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding new version update scripts #2947
Adding new version update scripts #2947
Conversation
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.
Please also handle google-cloud-nio-examples case.
In general I think it is good that there is now a single file with versions and a script which does nothing more than regexp replacements. The approach is not ideal, since it requires support from the pom/readmes themselves (the tokens), plus the resultant scripts are quite big, but I think it is definitely better than what we have now.
utilities/bump_versions.py
Outdated
self.snapshot = snapshot | ||
|
||
def __str__(self): | ||
mmp = str(self.major) + '.' + str(self.minor) + '.' + str(self.patch) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,111 @@ | |||
# Copyright 2018 Google LLC |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
import argparse | ||
import copy | ||
import re | ||
|
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
utilities/bump_versions.py
Outdated
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import argparse |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,108 @@ | |||
# Copyright 2018 Google LLC |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
version_regex_str = r'\d+\.\d+\.\d+(?:-\w+)?(?:-\w+)?' | ||
version_regex = re.compile(version_regex_str) | ||
|
||
class CodeModule: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
utilities/replace_versions.py
Outdated
if target: | ||
replace_versions(version_map, target) | ||
else: | ||
for root, dirs, files in os.walk("."): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
utilities/replace_versions.py
Outdated
else: | ||
match = version_update_end_marker.search(line) | ||
if match: | ||
repl_open = False |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I have addressed all feedback and tagged all versions. I verified it is correct by running bump_versions.py twice and grepping for the old version to make sure it appears nowhere. I also decided to solve the nio-examples case by just having it use "current", which means it will be set to the correct thing after a release when the releasing person calls |
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.
It looks like a lot of google-cloud
prefixes everywhere. Please consider renaming the tokens to just the service names without google-cloud
prefix (like it is already in bom pom.xml version properties).
RELEASING.md
Outdated
|
||
8. Run `utilities/update_versions.sh` again (to include "-SNAPSHOT" in the project version). Please refer to documentation in `utilities/update_versions.sh` for more details. | ||
12. Run `python utilities/bump_versions next_snapshot patch` to include "-SNAPSHOT" in the current project version, then run `python utilities/replace_versions.py` to update the `pom.xml` files. (If you see updates in `README.md` files at this step, you probably did something wrong.) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -12,7 +12,7 @@ | |||
<parent> | |||
<groupId>com.google.cloud</groupId> | |||
<artifactId>google-cloud-contrib</artifactId> | |||
<version>0.35.1-alpha-SNAPSHOT</version> | |||
<version>0.35.1-alpha-SNAPSHOT</version><!-- {x-version-update:google-cloud-pom:current} --> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -20,7 +20,7 @@ | |||
<parent> | |||
<groupId>com.google.cloud</groupId> | |||
<artifactId>google-cloud-contrib</artifactId> | |||
<version>0.35.1-alpha-SNAPSHOT</version> | |||
<version>0.35.1-alpha-SNAPSHOT</version><!-- {x-version-update:google-cloud-pom:current} --> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -21,6 +21,7 @@ To run this example: | |||
|
|||
4. Run the sample with: | |||
|
|||
[//]: # ({x-version-update-start:google-cloud-nio:current}) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -1,278 +0,0 @@ | |||
#!/bin/bash |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Addressed feedback, PTAL |
Oh, I forgot to address the top-level comment: I think it will be easier for people to manage the versions.txt file if the identifiers match the artifactId values; it also makes it more "scriptable" if people want to base scripts off of it for other purposes. |
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. Please address codacy-bot comments before merging.
versions.txt has both the last-released version (in maven) and the current version (either about-to-be-released or the snapshot version). There are two scripts: bump_versions.py: Bumps the versions stored in version.txt replace_versions.py: Idempotent script which replaces the versions everywhere they are tagged Users can choose to manually update versions.txt if they so choose and skip the bump_versions.py script.
versions.txt has both the last-released version (in maven) and the current version (either about-to-be-released or the snapshot version).
There are two scripts:
Users can choose to manually update versions.txt if they so choose and skip the bump_versions.py script.