Skip to content

Commit

Permalink
ci: split_release_note.py to use repo-metadata.json too
Browse files Browse the repository at this point in the history
Fixes #10297
  • Loading branch information
suztomo committed Jan 30, 2024
1 parent afec9c6 commit d33cc42
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 14 deletions.
28 changes: 28 additions & 0 deletions .github/release-note-generation/golden/java-vertexai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

## 0.50.0 (2023-06-08)

### Features

* some handwritten changes ([#1234](https://github.com/googleapis/google-cloud-java/issues/1234)) ([a268c80](https://github.com/googleapis/google-cloud-java/commit/a268c8016262a7a5a13be6a9983294f83d1ecc3f))

### Dependencies

* **deps:** update dependency com.google.cloud:google-cloud-shared-config to v1.5.6 ([#9494](https://github.com/googleapis/google-cloud-java/issues/9494)) ([739763f](https://github.com/googleapis/google-cloud-java/commit/739763f15ffa2434d7fa089899165f1e8fa5f870))
* **deps:** update dependency com.google.cloud:google-cloud-shared-dependencies to v3.11.0 ([#9505](https://github.com/googleapis/google-cloud-java/issues/9505)) ([30bc6f0](https://github.com/googleapis/google-cloud-java/commit/30bc6f0aef5b95549230dbd5b5246f2a8dab4ba4))


## [0.15.0](https://github.com/googleapis/google-cloud-java/compare/google-analytics-admin-v0.14.1-SNAPSHOT...google-analytics-admin-v0.15.0) (2022-10-24)


### Features

* Old Feature Release Note Entry


### Bug Fixes

* **deps:** update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#8325](https://github.com/googleapis/google-cloud-java/issues/8325)) ([01f492b](https://github.com/googleapis/google-cloud-java/commit/01f492be424acdb90edb23ba66656aeff7cf39eb))
* **deps:** update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#8528](https://github.com/googleapis/google-cloud-java/issues/8528)) ([bd36199](https://github.com/googleapis/google-cloud-java/commit/bd361998ac4eb7c78eef3b3eac39aef31a0cf44e))
* owl-bot-staging should not be commited ([#8337](https://github.com/googleapis/google-cloud-java/issues/8337)) ([c9bb4a9](https://github.com/googleapis/google-cloud-java/commit/c9bb4a97aa19032b78c86c951fe9920f24ac4eec))
* revert reverting [Many APIs] Update WORKSPACE files for rules_gapic, gax_java, generator_java versions ([#8340](https://github.com/googleapis/google-cloud-java/issues/8340)) ([dedef71](https://github.com/googleapis/google-cloud-java/commit/dedef71f600e85b1c38e7110f5ffd44bf2ba32b4))
2 changes: 1 addition & 1 deletion .github/release-note-generation/golden_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python3 "${basedir}/split_release_note.py" \
python3 "${basedir}/split_release_note.py" \
"${basedir}/testdata/main_release_note.txt" "${temp_dir}/testdata"

for module in java-analytics-admin java-maps-mapsplatformdatasets; do
for module in java-analytics-admin java-maps-mapsplatformdatasets java-vertexai; do
diff -u "${temp_dir}/testdata/${module}/CHANGELOG.md" "${basedir}/golden/${module}/CHANGELOG.md"
done

Expand Down
42 changes: 30 additions & 12 deletions .github/release-note-generation/split_release_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import re
from collections import defaultdict
from pathlib import Path
import json
import xml.etree.ElementTree as ET


Expand All @@ -39,26 +40,43 @@ def __repr__(self):
# Returns the list of target modules that has CHANGELOG.md
def detect_modules(root_directory: Path):
modules = []
for owlbot_yaml_path in root_directory.glob('*/.OwlBot.yaml'):

for repo_metadata_path in root_directory.glob('*/.repo-metadata.json'):
# This CHANGELOG.md might not exist for newly created libraries
changelog = owlbot_yaml_path.parent / 'CHANGELOG.md'
changelog = repo_metadata_path.parent / 'CHANGELOG.md'

module_pom_xml = owlbot_yaml_path.parent / 'pom.xml'
module_path = repo_metadata_path.parent
module_pom_xml = module_path / 'pom.xml'
owlbot_yaml_path = module_path/ '.OwlBot.yaml'
if not module_pom_xml.exists():
continue
tree = ET.parse(module_pom_xml)
root = tree.getroot()
version = root.find('mvn:version', POM_NAMESPACES).text
if owlbot_yaml_path.exists():
# If OwlBot configuration file exists (most cases), it's the better
# source to get the OwlBot-generated pull request title prefix than
# the repo-metadata.json
with open(owlbot_yaml_path, 'r') as file:
owlbot_yaml_content = file.read()
match = re.search(r'api-name: (.+)', owlbot_yaml_content)
if match:
api_name = match.group(1)
modules.append(LibraryModule(module_path, api_name,
version,
changelog))
else:
# vertexai (handwritten) does not have OwlBot yaml file
with open(repo_metadata_path, 'r') as file:
repo_metadata = json.load(file)
api_name = repo_metadata['api_shortname']
if api_name:
modules.append(LibraryModule(repo_metadata_path.parent, api_name,
version,
changelog))
else:
raise Exception(f'repo_metadata_path {repo_metadata_path} does'
f' not have api_shortname field')

with open(owlbot_yaml_path, 'r') as file:
owlbot_yaml_content = file.read()
match = re.search(r'api-name: (.+)', owlbot_yaml_content)
if match:
api_name = match.group(1)
modules.append(LibraryModule(owlbot_yaml_path, api_name,
version,
changelog))
return modules


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"api_shortname": "analyticsadmin",
"name_pretty": "Analytics Admin",
"product_documentation": "https://developers.google.com/analytics",
"api_description": "allows you to manage Google Analytics accounts and properties.",
"client_documentation": "https://cloud.google.com/java/docs/reference/google-analytics-admin/latest/overview",
"release_level": "preview",
"transport": "grpc",
"language": "java",
"repo": "googleapis/google-cloud-java",
"repo_short": "java-analytics-admin",
"distribution_name": "com.google.analytics:google-analytics-admin",
"api_id": "analyticsadmin.googleapis.com",
"requires_billing": true,
"codeowner_team": "@googleapis/analytics-dpe",
"library_type": "GAPIC_AUTO"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"api_shortname": "maps-mapsplatformdatasets",
"name_pretty": "Maps Platform Datasets API",
"product_documentation": "https://developers.google.com/maps/documentation",
"api_description": "The Maps Platform Datasets API enables developers to ingest geospatially-tied datasets\n that they can use to enrich their experience of Maps Platform solutions (e.g. styling, routing).",
"client_documentation": "https://cloud.google.com/java/docs/reference/google-maps-mapsplatformdatasets/latest/overview",
"release_level": "preview",
"transport": "grpc",
"language": "java",
"repo": "googleapis/java-maps-mapsplatformdatasets",
"repo_short": "java-maps-mapsplatformdatasets",
"distribution_name": "com.google.maps:google-maps-mapsplatformdatasets",
"api_id": "mapsplatformdatasets.googleapis.com",
"library_type": "GAPIC_AUTO",
"requires_billing": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"api_shortname": "vertexai",
"name_pretty": "VertexAI API",
"product_documentation": "https://cloud.google.com/vertex-ai/docs",
"api_description": "Vertex AI is an integrated suite of machine learning tools and services for building and using ML models with AutoML or custom code. It offers both novices and experts the best workbench for the entire machine learning development lifecycle.",
"client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/overview",
"release_level": "preview",
"transport": "both",
"language": "java",
"repo": "googleapis/java-vertexai",
"repo_short": "java-vertexai",
"distribution_name": "com.google.cloud:google-cloud-vertexai",
"api_id": "vertexai.googleapis.com",
"library_type": "GAPIC_COMBO",
"requires_billing": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

## [0.15.0](https://github.com/googleapis/google-cloud-java/compare/google-analytics-admin-v0.14.1-SNAPSHOT...google-analytics-admin-v0.15.0) (2022-10-24)


### Features

* Old Feature Release Note Entry


### Bug Fixes

* **deps:** update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#8325](https://github.com/googleapis/google-cloud-java/issues/8325)) ([01f492b](https://github.com/googleapis/google-cloud-java/commit/01f492be424acdb90edb23ba66656aeff7cf39eb))
* **deps:** update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#8528](https://github.com/googleapis/google-cloud-java/issues/8528)) ([bd36199](https://github.com/googleapis/google-cloud-java/commit/bd361998ac4eb7c78eef3b3eac39aef31a0cf44e))
* owl-bot-staging should not be commited ([#8337](https://github.com/googleapis/google-cloud-java/issues/8337)) ([c9bb4a9](https://github.com/googleapis/google-cloud-java/commit/c9bb4a97aa19032b78c86c951fe9920f24ac4eec))
* revert reverting [Many APIs] Update WORKSPACE files for rules_gapic, gax_java, generator_java versions ([#8340](https://github.com/googleapis/google-cloud-java/issues/8340)) ([dedef71](https://github.com/googleapis/google-cloud-java/commit/dedef71f600e85b1c38e7110f5ffd44bf2ba32b4))
13 changes: 13 additions & 0 deletions .github/release-note-generation/testdata/java-vertexai/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-vertexai-parent</artifactId>
<packaging>pom</packaging>
<version>0.50.0</version>
<name>Google VertexAI Parent</name>
<description>
Java idiomatic client for Google VertexAI.
</description>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* [clouddeploy] Add support for disabling Pod overprovisioning in the progressive deployment strategy configuration for a Kubernetes Target ([#9499](https://github.com/googleapis/google-cloud-java/issues/9499)) ([b7890c5](https://github.com/googleapis/google-cloud-java/commit/b7890c57859116d1f6033af9f485598d84428f44))
* [analyticsadmin] Add the resource definition of a STT recognizer ([#9492](https://github.com/googleapis/google-cloud-java/issues/9492)) ([f2baa92](https://github.com/googleapis/google-cloud-java/commit/f2baa928c4f4d9959591ea905d7c9042320dbc71))
* [maps-mapsplatformdatasets] new module for migrationcenter ([#9514](https://github.com/googleapis/google-cloud-java/issues/9514)) ([a268c80](https://github.com/googleapis/google-cloud-java/commit/a268c8016262a7a5a13be6a9983294f83d1ecc3f))

* [vertexai] some handwritten changes ([#1234](https://github.com/googleapis/google-cloud-java/issues/1234)) ([a268c80](https://github.com/googleapis/google-cloud-java/commit/a268c8016262a7a5a13be6a9983294f83d1ecc3f))

### Bug Fixes

Expand Down

0 comments on commit d33cc42

Please sign in to comment.