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 12 commits into
base: main
Choose a base branch
from
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
13 changes: 11 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,16 @@ if [ ! -z "${JAVA11_HOME}" ]; then
setJava "${JAVA11_HOME}"
fi

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

# this should run maven enforcer
retry_with_backoff 3 10 \
mvn install -B -V -ntp \
mvn install
-B -V \
${INSTALL_OPTS} \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dclirr.skip=true
Expand All @@ -64,4 +73,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: 7 additions & 2 deletions google-cloud-spanner-executor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@
<dependency>
<groupId>com.google.cloud.opentelemetry</groupId>
<artifactId>exporter-trace</artifactId>
<version>0.32.0</version>
<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>
Expand Down Expand Up @@ -266,7 +271,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
113 changes: 113 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,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>
Loading