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

ci(spanner): use airlock for fetching dependencies #3538

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
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
10 changes: 9 additions & 1 deletion .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

set -eo pipefail

set -x

## Get the directory of the build script
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
## cd to the parent directory, i.e. the root of the git repo
Expand All @@ -33,9 +35,15 @@ fi
mvn -version
echo ${JOB_TYPE}

INSTALL_OPTS=""
if [[ $ENABLE_AIRLOCK = 'true' ]]; then
INSTALL_OPTS="-Pairlock-trusted"
fi

# attempt to install 3 times with exponential backoff (starting with 10 seconds)
retry_with_backoff 3 10 \
mvn install -B -V -ntp \
mvn install -B -V \
${INSTALL_OPTS} \
-DskipTests=true \
-Dclirr.skip=true \
-Denforcer.skip=true \
Expand Down
18 changes: 16 additions & 2 deletions .kokoro/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
set -eo pipefail
shopt -s nullglob

set -x

## Get the directory of the build script
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
## cd to the parent directory, i.e. the root of the git repo
Expand Down Expand Up @@ -53,9 +55,21 @@ if [ ! -z "${JAVA11_HOME}" ]; then
setJava "${JAVA11_HOME}"
fi

INSTALL_OPTS=""
if [[ $ENABLE_AIRLOCK = 'true' ]]; then
INSTALL_OPTS="-Pairlock-trusted"
wget -q https://archive.apache.org/dist/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.zip -O /tmp/maven.zip && \
unzip /tmp/maven.zip -d /tmp/maven && \
rm -r /usr/local/lib/maven && \
mv /tmp/maven/apache-maven-3.9.9 /usr/local/lib/maven && \
rm /tmp/maven.zip && \
ls -la /usr/local/lib/maven
fi

# this should run maven enforcer
retry_with_backoff 3 10 \
mvn install -B -V -ntp \
mvn install -U -B -V \
${INSTALL_OPTS} \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dclirr.skip=true
Expand All @@ -64,4 +78,4 @@ if [ ! -z "${JAVA8_HOME}" ]; then
setJava "${JAVA8_HOME}"
fi

mvn -B dependency:analyze -DfailOnWarning=true
mvn -B ${INSTALL_OPTS} dependency:analyze -DfailOnWarning=true
5 changes: 5 additions & 0 deletions .kokoro/presubmit/dependencies.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/java-spanner/.kokoro/dependencies.sh"
}

env_vars: {
key: "ENABLE_AIRLOCK",
value: "true"
}
8 changes: 8 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>com.google.cloud.artifactregistry</groupId>
<artifactId>artifactregistry-maven-wagon</artifactId>
<version>2.2.3</version>
</extension>
</extensions>
87 changes: 87 additions & 0 deletions google-cloud-spanner-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,91 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<!-- Profile to use Airlock (go/airlock/howto_maven). Disabled by default. -->
<id>airlock-trusted</id>
<pluginRepositories>
<pluginRepository>
<id>airlock</id>
<name>Airlock</name>
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>central</id>
<!-- Disable default Maven Central -->
<name>Maven Central remote repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rso-public-grid</id>
<!-- Disable default sonatype public grid -->
<name>Maven Central Sonatype repository</name>
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>airlock</id>
<name>Airlock</name>
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>central</id>
<!-- Disable default Maven Central -->
<name>Maven Central remote repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>rso-public-grid</id>
<!-- Disable default sonatype public grid -->
<name>Maven Central Sonatype repository</name>
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</project>
9 changes: 8 additions & 1 deletion google-cloud-spanner-executor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
<artifactId>exporter-trace</artifactId>
<version>0.33.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud.opentelemetry</groupId>
<artifactId>shared-resourcemapping</artifactId>
<version>0.33.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
Expand Down Expand Up @@ -200,7 +205,9 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
Expand Down Expand Up @@ -266,7 +273,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<ignoredDependencies> com.google.api:gax,org.apache.maven.surefire:surefire-junit4 </ignoredDependencies>
<ignoredDependencies> com.google.api:gax,org.apache.maven.surefire:surefire-junit4,com.google.cloud.opentelemetry:shared-resourcemapping</ignoredDependencies>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 2 additions & 0 deletions google-cloud-spanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.4</version>
<configuration>
<buildArgs combine.children="append">
<buildArg>-Dspanner.testenv.config.class=${spanner.testenv.config.class}</buildArg>
Expand All @@ -133,6 +134,7 @@
<?m2e ignore?>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>

<plugin>
Expand Down
1 change: 1 addition & 0 deletions grpc-google-cloud-spanner-admin-database-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<?m2e ignore?>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>
</plugins>
</build>
Expand Down
1 change: 1 addition & 0 deletions grpc-google-cloud-spanner-admin-instance-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<?m2e ignore?>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>
</plugins>
</build>
Expand Down
1 change: 1 addition & 0 deletions grpc-google-cloud-spanner-executor-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<?m2e ignore?>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>
</plugins>
</build>
Expand Down
1 change: 1 addition & 0 deletions grpc-google-cloud-spanner-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<?m2e ignore?>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>
</plugins>
</build>
Expand Down
118 changes: 118 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -234,4 +239,117 @@
</plugin>
</plugins>
</reporting>

<profiles>
<profile>
<!-- Profile to use Airlock (go/airlock/howto_maven). Disabled by default. -->
<id>airlock-trusted</id>
<pluginRepositories>
<pluginRepository>
<id>airlock</id>
<name>Airlock</name>
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<!-- Adding a fallback to airlock 3p staging till all the license verification issues are resolved -->
<pluginRepository>
<id>airlock-staging</id>
<name>Airlock</name>
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>central</id>
<!-- Disable default Maven Central -->
<name>Maven Central remote repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rso-public-grid</id>
<!-- Disable default sonatype public grid -->
<name>Maven Central Sonatype repository</name>
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>airlock</id>
<name>Airlock</name>
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- Adding a fallback to airlock 3p staging till all the license verification issues are resolved -->
<repository>
<id>airlock-staging</id>
<name>Airlock</name>
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>central</id>
<!-- Disable default Maven Central -->
<name>Maven Central remote repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>rso-public-grid</id>
<!-- Disable default sonatype public grid -->
<name>Maven Central Sonatype repository</name>
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</project>
1 change: 1 addition & 0 deletions proto-google-cloud-spanner-admin-database-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<?m2e ignore?>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>
</plugins>
</build>
Expand Down
Loading
Loading