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 Nov 26, 2024
1 parent ed0ad28 commit 75b06b8
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .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,16 @@ fi
mvn -version
echo ${JOB_TYPE}

# Enable airlock only for Kokoro jobs
INSTALL_OPTS=""
if [[ ! -z "${KOKORO_JOB_TYPE}" && ${KOKORO_JOB_TYPE} =~ ^.*presubmit.*$ ]]; 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 \
${INSTALL_OPTS} \
-DskipTests=true \
-Dclirr.skip=true \
-Denforcer.skip=true \
Expand Down
7 changes: 7 additions & 0 deletions .kokoro/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,16 @@ if [ ! -z "${JAVA11_HOME}" ]; then
setJava "${JAVA11_HOME}"
fi

# Enable airlock only for Kokoro jobs
INSTALL_OPTS=""
if [[ ! -z "${KOKORO_JOB_TYPE}" ]]; then
INSTALL_OPTS="-Pairlock-trusted"
fi

# this should run maven enforcer
retry_with_backoff 3 10 \
mvn install -B -V -ntp \
${INSTALL_OPTS} \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dclirr.skip=true
Expand Down
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 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 75b06b8

Please sign in to comment.