Skip to content

Commit

Permalink
ci(spanner): use airlock for fetching dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sakthivelmanii committed Dec 9, 2024
1 parent 134be9b commit aa27d83
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 3 deletions.
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
12 changes: 10 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,15 @@ 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 +72,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>
113 changes: 113 additions & 0 deletions google-cloud-spanner-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,117 @@
</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>
<!-- 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>
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>

0 comments on commit aa27d83

Please sign in to comment.