Skip to content

Commit 5e161a7

Browse files
fix(hermetic-build): do not add release please comments on vertexai poms (#12559)
1 parent 0632811 commit 5e161a7

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

sdk-platform-java/hermetic_build/library_generation/owlbot/src/fix_poms.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ def update_parent_pom(filename: str, modules: List[module.Module]):
273273
new_dependency.append(new_group)
274274
new_dependency.append(new_artifact)
275275
new_dependency.append(new_version)
276-
new_dependency.append(comment)
276+
if "vertexai" not in m.artifact_id:
277+
new_dependency.append(comment)
277278
new_dependency.tail = "\n "
278279
dependencies.insert(1, new_dependency)
279280

@@ -310,7 +311,8 @@ def update_bom_pom(filename: str, modules: List[module.Module]):
310311
new_dependency.append(new_group)
311312
new_dependency.append(new_artifact)
312313
new_dependency.append(new_version)
313-
new_dependency.append(comment)
314+
if "vertexai" not in m.artifact_id:
315+
new_dependency.append(comment)
314316

315317
if index == num_modules - 1:
316318
new_dependency.tail = "\n "

sdk-platform-java/hermetic_build/library_generation/tests/owlbot/fix_poms_unit_tests.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,53 @@ def test_update_poms_group_id_does_not_start_with_google_correctly(self):
3535
for sub_dir in sub_dirs:
3636
self.__remove_file_in_subdir(ad_manager_resource, sub_dir)
3737

38+
def test_update_bom_pom_excludes_vertexai_comment(self):
39+
import tempfile
40+
from library_generation.owlbot.src.poms.module import Module
41+
from library_generation.owlbot.src.fix_poms import update_bom_pom
42+
43+
# Minimal XML structure
44+
initial_xml = """<?xml version="1.0" encoding="utf-8"?>
45+
<project xmlns="http://maven.apache.org/POM/4.0.0">
46+
<dependencyManagement>
47+
<dependencies>
48+
</dependencies>
49+
</dependencyManagement>
50+
</project>"""
51+
52+
with tempfile.NamedTemporaryFile(mode="w+", delete=False) as tmp:
53+
tmp.write(initial_xml)
54+
tmp_path = tmp.name
55+
56+
try:
57+
modules = [
58+
Module(
59+
group_id="com.google.cloud",
60+
artifact_id="google-cloud-vertexai",
61+
version="1.0.0",
62+
release_version="1.0.0",
63+
),
64+
Module(
65+
group_id="com.google.cloud",
66+
artifact_id="google-cloud-datastore",
67+
version="1.0.0",
68+
release_version="1.0.0",
69+
),
70+
]
71+
72+
update_bom_pom(tmp_path, modules)
73+
74+
with open(tmp_path, "r") as f:
75+
content = f.read()
76+
77+
self.assertNotIn("x-version-update:google-cloud-vertexai:current", content)
78+
self.assertIn("x-version-update:google-cloud-datastore:current", content)
79+
80+
finally:
81+
import os
82+
83+
os.unlink(tmp_path)
84+
3885
@classmethod
3986
def __copy__golden(cls, base_dir: str, subdir: str):
4087
golden = os.path.join(base_dir, subdir, "pom-golden.xml")

0 commit comments

Comments
 (0)