-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(hermetic-build): do not add release please comments on vertexai poms #12559
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,53 @@ def test_update_poms_group_id_does_not_start_with_google_correctly(self): | |
| for sub_dir in sub_dirs: | ||
| self.__remove_file_in_subdir(ad_manager_resource, sub_dir) | ||
|
|
||
| def test_update_bom_pom_excludes_vertexai_comment(self): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| import tempfile | ||
| from library_generation.owlbot.src.poms.module import Module | ||
| from library_generation.owlbot.src.fix_poms import update_bom_pom | ||
|
Comment on lines
+39
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to PEP 8, imports should be placed at the top of the file. Importing modules like References
|
||
|
|
||
| # Minimal XML structure | ||
| initial_xml = """<?xml version="1.0" encoding="utf-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0"> | ||
| <dependencyManagement> | ||
| <dependencies> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
| </project>""" | ||
|
|
||
| with tempfile.NamedTemporaryFile(mode="w+", delete=False) as tmp: | ||
| tmp.write(initial_xml) | ||
| tmp_path = tmp.name | ||
|
|
||
| try: | ||
| modules = [ | ||
| Module( | ||
| group_id="com.google.cloud", | ||
| artifact_id="google-cloud-vertexai", | ||
| version="1.0.0", | ||
| release_version="1.0.0", | ||
| ), | ||
| Module( | ||
| group_id="com.google.cloud", | ||
| artifact_id="google-cloud-datastore", | ||
| version="1.0.0", | ||
| release_version="1.0.0", | ||
| ), | ||
| ] | ||
|
|
||
| update_bom_pom(tmp_path, modules) | ||
|
|
||
| with open(tmp_path, "r") as f: | ||
| content = f.read() | ||
|
|
||
| self.assertNotIn("x-version-update:google-cloud-vertexai:current", content) | ||
| self.assertIn("x-version-update:google-cloud-datastore:current", content) | ||
|
|
||
| finally: | ||
| import os | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the imports at the beginning of the method, References
|
||
|
|
||
| os.unlink(tmp_path) | ||
|
|
||
| @classmethod | ||
| def __copy__golden(cls, base_dir: str, subdir: str): | ||
| golden = os.path.join(base_dir, subdir, "pom-golden.xml") | ||
|
|
||
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.
The logic to exclude 'vertexai' artifacts from receiving 'release please' comments is duplicated here and in
update_bom_pom(line 314). Consider refactoring this into a shared constant or a helper function to improve maintainability and ensure consistency across different POM update functions.