Skip to content

Commit e00f73f

Browse files
authored
Merge branch 'main' into feat/deleteSourceObjects-compose-10602500430278326901
2 parents c1d196a + 1431e11 commit e00f73f

1,327 files changed

Lines changed: 10615 additions & 1765 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/release-note-generation/split_release_note.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def detect_modules(root_directory: Path):
6969
tree = ET.parse(module_pom_xml)
7070
root = tree.getroot()
7171
version = root.find('mvn:version', POM_NAMESPACES).text
72+
api_name = None
7273
if owlbot_yaml_path.exists():
7374
# If OwlBot configuration file exists (most cases), it's the better
7475
# source to get the OwlBot-generated pull request title prefix than
@@ -78,21 +79,21 @@ def detect_modules(root_directory: Path):
7879
match = re.search(r'api-name: (.+)', owlbot_yaml_content)
7980
if match:
8081
api_name = match.group(1)
81-
modules.append(LibraryModule(module_path, api_name,
82-
version,
83-
changelog))
82+
83+
if not api_name:
84+
# Fallback to repo-metadata.json (e.g. for vertexai or Spanner transitional state)
85+
if repo_metadata_path.exists():
86+
with open(repo_metadata_path, 'r') as file:
87+
repo_metadata = json.load(file)
88+
api_name = repo_metadata.get('api_shortname')
89+
90+
if api_name:
91+
modules.append(LibraryModule(module_path, api_name,
92+
version,
93+
changelog))
8494
else:
85-
# vertexai (handwritten) does not have OwlBot yaml file
86-
with open(repo_metadata_path, 'r') as file:
87-
repo_metadata = json.load(file)
88-
api_name = repo_metadata['api_shortname']
89-
if api_name:
90-
modules.append(LibraryModule(repo_metadata_path.parent, api_name,
91-
version,
92-
changelog))
93-
else:
94-
raise Exception(f'repo_metadata_path {repo_metadata_path} does'
95-
f' not have api_shortname field')
95+
raise Exception(f'Could not determine api-name for {repo_metadata_path}')
96+
9697

9798
return modules
9899

@@ -133,7 +134,7 @@ def group_changes_by_api(main_changes: [str]):
133134
elif section == BUG_FIXES_SECTION:
134135
api_to_changelog[api_name].bug_fixes.append(note)
135136
elif section == DEPENDENCIES_SECTION:
136-
api_to_changelog[api_name].dependencies.append(note)
137+
api_to_changelog[api_name].dependency_upgrades.append(note)
137138
return api_to_changelog
138139

139140

.github/release-note-generation/unit_test.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import unittest
2+
import tempfile
3+
import json
4+
from pathlib import Path
25

36
# Unit tests for split_release_note.py
47

5-
from split_release_note import LibraryModule, create_changelog_entry, group_changes_by_api, ChangesOnApi
6-
from pathlib import Path
8+
from split_release_note import LibraryModule, create_changelog_entry, group_changes_by_api, ChangesOnApi, detect_modules
79

810
dummy_module = LibraryModule(
911
Path('release-note-generation/test/java-analyics-admin'),
@@ -81,6 +83,31 @@ def test_group_changes_by_api(self):
8183
['No change']),
8284
['No change'])
8385

86+
def test_detect_modules_fallback(self):
87+
with tempfile.TemporaryDirectory() as tmpdirname:
88+
tmp_path = Path(tmpdirname)
89+
module_path = tmp_path / "java-spanner"
90+
module_path.mkdir()
91+
92+
# Create minimal pom.xml
93+
pom_path = module_path / "pom.xml"
94+
with open(pom_path, "w") as f:
95+
f.write('<project xmlns:mvn="http://maven.apache.org/POM/4.0.0"><mvn:version>1.0.0</mvn:version></project>')
96+
97+
# Create .repo-metadata.json with api_shortname
98+
metadata_path = module_path / ".repo-metadata.json"
99+
with open(metadata_path, "w") as f:
100+
json.dump({"api_shortname": "spanner"}, f)
101+
102+
# Create CHANGELOG.md
103+
changelog_path = module_path / "CHANGELOG.md"
104+
changelog_path.touch()
105+
106+
modules = detect_modules(tmp_path)
107+
self.assertEqual(len(modules), 1)
108+
self.assertEqual(modules[0].api_name, "spanner")
109+
self.assertEqual(modules[0].version, "1.0.0")
110+
84111

85112
if __name__ == "__main__":
86113
unittest.main()

.github/workflows/ci.yaml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,11 @@ jobs:
3434
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3535
id: filter
3636
with:
37-
# we want to run tests if source code is changed or the scripts
38-
# used to run the unit tests
3937
filters: |
4038
src:
41-
- '**/*.java'
42-
- '**/pom.xml'
43-
- '!java-bigquery/**'
44-
- '!java-bigquerystorage/**'
45-
- '!java-datastore/**'
46-
- '!java-logging-logback/**'
47-
- '!java-logging/**'
48-
- '!java-spanner/**'
49-
- '!java-storage/**'
50-
- '!google-auth-library-java/**'
39+
- '!(java-bigquery|java-bigquerystorage|java-datastore|java-logging-logback|java-logging|java-spanner|java-storage|google-auth-library-java)/**/*.java'
40+
- '!(java-bigquery|java-bigquerystorage|java-datastore|java-logging-logback|java-logging|java-spanner|java-storage|google-auth-library-java)/**/pom.xml'
41+
- 'pom.xml'
5142
ci:
5243
- '.github/workflows/ci.yaml'
5344
- '.kokoro/**'
@@ -246,8 +237,28 @@ jobs:
246237
JOB_TYPE: test
247238
JOB_NAME: units-8-runtime-${{matrix.java}}
248239
working-directory: ${{matrix.package}}
240+
split-clirr:
241+
runs-on: ubuntu-latest
242+
needs: changes
243+
strategy:
244+
matrix:
245+
package: ${{ fromJSON(needs.changes.outputs.packages) }}
246+
steps:
247+
- name: Get current week within the year
248+
id: date
249+
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
250+
- uses: actions/checkout@v4
251+
- uses: actions/setup-java@v4
252+
with:
253+
distribution: temurin
254+
java-version: 11
255+
- run: .kokoro/build.sh
256+
env:
257+
BUILD_SUBDIR: ${{matrix.package}}
258+
JOB_TYPE: clirr
259+
JOB_NAME: clirr-${{matrix.package}}
249260
required:
250-
needs: [ changes, split-units ]
261+
needs: [ changes, split-units, split-clirr ]
251262
name: conditional-required-check
252263
if: ${{ always() }} # Always run even if any "needs" jobs fail
253264
runs-on: ubuntu-22.04

.github/workflows/google-auth-library-java-ci.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,24 @@ jobs:
5555
BUILD_SUBDIR: google-auth-library-java
5656
JOB_TYPE: test
5757
SUREFIRE_JVM_OPT: "-P '!slf4j2x,slf4j2x-test'"
58+
clirr:
59+
needs: filter
60+
if: ${{ needs.filter.outputs.library == 'true' }}
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v3
64+
- uses: actions/setup-java@v3
65+
with:
66+
distribution: temurin
67+
java-version: 11
68+
- run: java -version
69+
- run: .kokoro/build.sh
70+
env:
71+
JOB_TYPE: clirr
72+
BUILD_SUBDIR: google-auth-library-java
73+
5874
required:
59-
needs: [ units-logging ]
75+
needs: [ units-logging, clirr ]
6076
name: conditional-required-check
6177
if: ${{ always() }} # Always run even if any "needs" jobs fail
6278
runs-on: ubuntu-22.04

.github/workflows/hermetic_library_generation.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ jobs:
4747
head_ref: ${{ github.head_ref }}
4848
token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
4949
force_regenerate_all: ${{ github.event.pull_request.head.ref == 'generate-libraries-main' }}
50+
showcase_mode: true
5051
image_tag: ${{ env.GENERATOR_VERSION }}

0 commit comments

Comments
 (0)