From 75b06b89bf17df8c510244bc51b910eb9ee8c553 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 26 Nov 2024 11:02:04 +0530 Subject: [PATCH] ci(spanner): use airlock for fetching dependencies --- .kokoro/build.sh | 9 ++++ .kokoro/dependencies.sh | 7 +++ .mvn/extensions.xml | 8 +++ pom.xml | 113 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 .mvn/extensions.xml diff --git a/.kokoro/build.sh b/.kokoro/build.sh index d603c59859b..c17f0264eb7 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -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 @@ -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 \ diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index 3c613d6b56d..7fc722077aa 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -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 diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 00000000000..38f37df431b --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,8 @@ + + + com.google.cloud.artifactregistry + artifactregistry-maven-wagon + 2.2.3 + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 191e70768a6..93534105ebd 100644 --- a/pom.xml +++ b/pom.xml @@ -234,4 +234,117 @@ + + + + + airlock-trusted + + + airlock + Airlock + artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted + default + + true + + + true + + + + + airlock-staging + Airlock + artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven + default + + true + + + true + + + + central + + Maven Central remote repository + https://repo.maven.apache.org/maven2 + default + + false + + + false + + + + rso-public-grid + + Maven Central Sonatype repository + https://repository.sonatype.org/content/groups/sonatype-public-grid + default + + false + + + false + + + + + + airlock + Airlock + artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted + default + + true + + + true + + + + + airlock-staging + Airlock + artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven + default + + true + + + true + + + + central + + Maven Central remote repository + https://repo.maven.apache.org/maven2 + default + + false + + + false + + + + rso-public-grid + + Maven Central Sonatype repository + https://repository.sonatype.org/content/groups/sonatype-public-grid + default + + false + + + false + + + + +