Skip to content

Commit 46654e0

Browse files
authored
feat: GAPIC library BOM in monorepo_script bootstrap (#7991)
* feat: GAPIC library BOM in monorepo_script bootstrap * fix: run validate before creating CoverageAggregator
1 parent f7621bf commit 46654e0

File tree

4 files changed

+149
-0
lines changed

4 files changed

+149
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,12 @@ For Day 1 cutover, once we have main branch:
3939
- Update `googleapis_commit.txt` to an appropriate value
4040
- Update `.github/workflows/googleapis_hermetic_sync.yaml` to point to
4141
the main branch.
42+
43+
### The BOM coverage and its version
44+
45+
Review the artifact name "google-cloud-gapic-bom" in the bom directory and
46+
configure the version managed by Release Please. Ensure the BOM is part of the
47+
entire release pipeline.
48+
49+
Confirm the effective-pom (`mvn help:effective-pom`) of the BOM covers the same
50+
member of the google-cloud-bom except the handwritten libraries.

bom.pom.xml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.google.cloud</groupId>
5+
<artifactId>google-cloud-gapic-bom</artifactId>
6+
<packaging>pom</packaging>
7+
<version>0.0.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-gapic-bom:current} -->
8+
<name>Google Cloud Java BOM</name>
9+
<url>https://github.com/googleapis/java-cloud-bom</url>
10+
<description>
11+
BOM for the libraries in google-cloud-java repository. Users should not
12+
depend on this artifact explicitly because this BOM is an implementation
13+
detail of the Libraries BOM.
14+
</description>
15+
<dependencyManagement>
16+
<dependencies>
17+
BOM_ARTIFACT_LIST
18+
</dependencies>
19+
</dependencyManagement>
20+
21+
<build>
22+
<plugins>
23+
<plugin>
24+
<groupId>org.sonatype.plugins</groupId>
25+
<artifactId>nexus-staging-maven-plugin</artifactId>
26+
<version>1.6.13</version>
27+
<extensions>true</extensions>
28+
<configuration>
29+
<serverId>sonatype-nexus-staging</serverId>
30+
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
31+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
32+
</configuration>
33+
</plugin>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-site-plugin</artifactId>
37+
<version>3.12.0</version>
38+
<configuration>
39+
<skipDeploy>true</skipDeploy>
40+
</configuration>
41+
</plugin>
42+
</plugins>
43+
</build>
44+
45+
<profiles>
46+
<profile>
47+
<id>release</id>
48+
<activation>
49+
<property>
50+
<name>performRelease</name>
51+
</property>
52+
</activation>
53+
<build>
54+
<plugins>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-gpg-plugin</artifactId>
58+
<version>3.0.1</version>
59+
<executions>
60+
<execution>
61+
<id>sign-artifacts</id>
62+
<phase>verify</phase>
63+
<goals>
64+
<goal>sign</goal>
65+
</goals>
66+
<configuration>
67+
<gpgArguments>
68+
<arg>--pinentry-mode</arg>
69+
<arg>loopback</arg>
70+
</gpgArguments>
71+
</configuration>
72+
</execution>
73+
</executions>
74+
</plugin>
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-source-plugin</artifactId>
78+
<version>3.2.1</version>
79+
<executions>
80+
<execution>
81+
<id>attach-sources</id>
82+
<goals>
83+
<goal>jar-no-fork</goal>
84+
</goals>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
</profile>
91+
</profiles>
92+
</project>

bootstrap.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ do
4242
text=${text/api_shortname/api-name}
4343
echo -e "\n"$text>> ${service}/.OwlBot.yaml
4444
git add .
45+
git config --add secrets.allowed "dest.*src"
4546
git commit -am "chore: setup owlbot configuration"
4647

4748
cd ../google-cloud-java
@@ -63,10 +64,56 @@ cd google-cloud-java
6364
git add pom.xml
6465
git commit -am 'feat: create aggregator pom'
6566

67+
# generate BOM of the artifacts in this repository
68+
bom_lines=""
69+
for bom_directory in $(find . -name 'google-*-bom' | sort); do
70+
repo_metadata="${bom_directory}/../.repo-metadata.json"
71+
pom_file="${bom_directory}/pom.xml"
72+
groupId_line=$(grep --max-count=1 'groupId' "${pom_file}")
73+
artifactId_line=$(grep --max-count=1 'artifactId' "${pom_file}")
74+
version_line=$(grep --max-count=1 'x-version-update' "${pom_file}")
75+
if ! grep --quiet '"release_level": "stable"' "${repo_metadata}"; then
76+
# Not including non-GA libraries, except those that happened to be included
77+
# already in google-cloud-bom.
78+
if [[ $artifactId_line != *"google-cloud-datalabeling"* ]] \
79+
&& [[ $artifactId_line != *"google-cloud-errorreporting"* ]] \
80+
&& [[ $artifactId_line != *"google-cloud-logging-logback"* ]] \
81+
&& [[ $artifactId_line != *"google-cloud-mediatranslation"* ]] \
82+
&& [[ $artifactId_line != *"google-cloud-nio"* ]] \
83+
&& [[ $artifactId_line != *"google-cloud-notification"* ]] \
84+
&& [[ $artifactId_line != *"google-cloud-phishingprotection"* ]]; then
85+
echo "Not adding ${pom_file} to the BOM because it's not stable."
86+
continue
87+
fi
88+
fi
89+
90+
bom_lines+=" <dependency>
91+
${groupId_line}
92+
${artifactId_line}
93+
${version_line}
94+
<type>pom</type>
95+
<scope>import</scope>
96+
</dependency>
97+
"
98+
done
99+
100+
mkdir google-cloud-gapic-bom
101+
awk -v "dependencyManagements=$bom_lines" '{gsub(/BOM_ARTIFACT_LIST/,dependencyManagements)}1' \
102+
../../bom.pom.xml > google-cloud-gapic-bom/pom.xml
103+
104+
git add google-cloud-gapic-bom/pom.xml
105+
git commit -am 'feat: create bom module'
106+
107+
# Confirm everything is fine so far
108+
mvn -q -B -ntp validate
109+
110+
111+
# Template files
66112
cp -r --preserve=all ../../templates/. ./
67113
git add --all
68114
git commit -m 'chore: add template files'
69115

116+
70117
# generate coverage report
71118
mkdir CoverageAggregator
72119
cp ../../coverage.pom.xml CoverageAggregator/pom.xml

parent.pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</properties>
1414

1515
<modules>
16+
<module>google-cloud-gapic-bom</module>
1617
</modules>
1718

1819
<build>

0 commit comments

Comments
 (0)