Skip to content
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

Merged
merged 7 commits into from
Feb 26, 2018

Conversation

garrettjonesgoogle
Copy link
Member

@garrettjonesgoogle garrettjonesgoogle commented Feb 23, 2018

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.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 23, 2018
Copy link
Contributor

@vam-google vam-google left a 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.

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.

@@ -0,0 +1,111 @@
# Copyright 2018 Google LLC

This comment was marked as spam.

This comment was marked as spam.

import argparse
import copy
import re

This comment was marked as spam.

This comment was marked as spam.

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

@@ -0,0 +1,108 @@
# Copyright 2018 Google LLC

This comment was marked as spam.

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.

This comment was marked as spam.

This comment was marked as spam.

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.

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.

@garrettjonesgoogle garrettjonesgoogle changed the title Partial impl: Adding new version update scripts Adding new version update scripts Feb 24, 2018
@garrettjonesgoogle
Copy link
Member Author

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 bump_version.py next_snapshot patch. PTAL

Copy link
Contributor

@vam-google vam-google left a 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.

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

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

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

@@ -1,278 +0,0 @@
#!/bin/bash

This comment was marked as spam.

This comment was marked as spam.

@garrettjonesgoogle
Copy link
Member Author

Addressed feedback, PTAL

@garrettjonesgoogle
Copy link
Member Author

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.

Copy link
Contributor

@vam-google vam-google left a 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.

@garrettjonesgoogle garrettjonesgoogle merged commit 7afa034 into googleapis:master Feb 26, 2018
schmidt-sebastian pushed a commit that referenced this pull request Feb 27, 2018
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants