Skip to content
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

feat: GAPIC library BOM in monorepo_script bootstrap #7991

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ For Day 1 cutover, once we have main branch:
- Update `googleapis_commit.txt` to an appropriate value
- Update `.github/workflows/googleapis_hermetic_sync.yaml` to point to
the main branch.

### The BOM coverage and its version

Review the artifact name "google-cloud-gapic-bom" in the bom directory and
configure the version managed by Release Please. Ensure the BOM is part of the
entire release pipeline.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ddixit14 This message is for you in near future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will keep this in mind.


Confirm the effective-pom (`mvn help:effective-pom`) of the BOM covers the same
member of the google-cloud-bom except the handwritten libraries.
92 changes: 92 additions & 0 deletions bom.pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?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-cloud-gapic-bom</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-gapic-bom:current} -->
<name>Google Cloud Java BOM</name>
<url>https://github.com/googleapis/java-cloud-bom</url>
<description>
BOM for the libraries in google-cloud-java repository. Users should not
depend on this artifact explicitly because this BOM is an implementation
detail of the Libraries BOM.
</description>
<dependencyManagement>
<dependencies>
BOM_ARTIFACT_LIST
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably need <dependencies> before the placeholder, and a closing one after.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the check failed with Error: Malformed POM /home/runner/work/google-cloud-java/google-cloud-java/monorepo/google-cloud-java/bom/pom.xml: Unrecognised tag: 'dependency' (position: START_TAG seen ...<dependencyManagement>\n <dependency>... @16:17) @ /home/runner/work/google-cloud-java/google-cloud-java/monorepo/google-cloud-java/bom/pom.xml, line 16, column 17.

</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.0</version>
<configuration>
<skipDeploy>true</skipDeploy>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
47 changes: 47 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ do
text=${text/api_shortname/api-name}
echo -e "\n"$text>> ${service}/.OwlBot.yaml
git add .
git config --add secrets.allowed "dest.*src"
git commit -am "chore: setup owlbot configuration"

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

# generate BOM of the artifacts in this repository
bom_lines=""
for bom_directory in $(find . -name 'google-*-bom' | sort); do
repo_metadata="${bom_directory}/../.repo-metadata.json"
pom_file="${bom_directory}/pom.xml"
groupId_line=$(grep --max-count=1 'groupId' "${pom_file}")
artifactId_line=$(grep --max-count=1 'artifactId' "${pom_file}")
version_line=$(grep --max-count=1 'x-version-update' "${pom_file}")
if ! grep --quiet '"release_level": "stable"' "${repo_metadata}"; then
# Not including non-GA libraries, except those that happened to be included
# already in google-cloud-bom.
if [[ $artifactId_line != *"google-cloud-datalabeling"* ]] \
&& [[ $artifactId_line != *"google-cloud-errorreporting"* ]] \
&& [[ $artifactId_line != *"google-cloud-logging-logback"* ]] \
&& [[ $artifactId_line != *"google-cloud-mediatranslation"* ]] \
&& [[ $artifactId_line != *"google-cloud-nio"* ]] \
&& [[ $artifactId_line != *"google-cloud-notification"* ]] \
&& [[ $artifactId_line != *"google-cloud-phishingprotection"* ]]; then
echo "Not adding ${pom_file} to the BOM because it's not stable."
continue
fi
fi

bom_lines+=" <dependency>
${groupId_line}
${artifactId_line}
${version_line}
<type>pom</type>
<scope>import</scope>
</dependency>
"
done

mkdir google-cloud-gapic-bom
awk -v "dependencyManagements=$bom_lines" '{gsub(/BOM_ARTIFACT_LIST/,dependencyManagements)}1' \
../../bom.pom.xml > google-cloud-gapic-bom/pom.xml

git add google-cloud-gapic-bom/pom.xml
git commit -am 'feat: create bom module'

# Confirm everything is fine so far
mvn -q -B -ntp validate


# Template files
cp -r --preserve=all ../../templates/. ./
git add --all
git commit -m 'chore: add template files'


# generate coverage report
mkdir CoverageAggregator
cp ../../coverage.pom.xml CoverageAggregator/pom.xml
Expand Down
1 change: 1 addition & 0 deletions parent.pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</properties>

<modules>
<module>google-cloud-gapic-bom</module>
</modules>

<build>
Expand Down