From aa27d832bd99f06f8d349face86f9deaf76c2455 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Mon, 9 Dec 2024 21:43:41 +0530 Subject: [PATCH] ci(spanner): use airlock for fetching dependencies --- .kokoro/build.sh | 10 ++- .kokoro/dependencies.sh | 12 ++- .kokoro/presubmit/dependencies.cfg | 5 ++ .mvn/extensions.xml | 8 ++ google-cloud-spanner-bom/pom.xml | 113 +++++++++++++++++++++++++++++ pom.xml | 113 +++++++++++++++++++++++++++++ 6 files changed, 258 insertions(+), 3 deletions(-) create mode 100644 .mvn/extensions.xml diff --git a/.kokoro/build.sh b/.kokoro/build.sh index d603c59859b..69d53d01dc2 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,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 \ diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index 3c613d6b56d..623385d8a61 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -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 @@ -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 @@ -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 diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg index 808bf138e1c..9e1ffbc98d7 100644 --- a/.kokoro/presubmit/dependencies.cfg +++ b/.kokoro/presubmit/dependencies.cfg @@ -10,3 +10,8 @@ env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/java-spanner/.kokoro/dependencies.sh" } + +env_vars: { + key: "ENABLE_AIRLOCK", + value: "true" +} \ No newline at end of file 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/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 1db01f10946..71007d8b273 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -119,4 +119,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 + + + + + diff --git a/pom.xml b/pom.xml index 72a2a6797e3..a1b6a07cb27 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 + + + + +