Skip to content

Commit eadf998

Browse files
committed
test: option to use snapshot repository in an artifact registry
1 parent a46793a commit eadf998

File tree

3 files changed

+56
-10
lines changed

3 files changed

+56
-10
lines changed

.kokoro/build.sh

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,37 @@ source ${scriptDir}/common.sh
2727
mvn -version
2828
echo ${JOB_TYPE}
2929

30-
# attempt to install 3 times with exponential backoff (starting with 10 seconds)
31-
retry_with_backoff 3 10 \
32-
mvn install -B -V -ntp \
33-
-DskipTests=true \
34-
-Dclirr.skip=true \
35-
-Denforcer.skip=true \
36-
-Dcheckstyle.skip=true \
37-
-Dmaven.javadoc.skip=true \
38-
-Dgcloud.download.skip=true \
39-
-T 1C
30+
# TODO: We'll change define this value in a different place later
31+
if [[ "${JOB_TYPE}" == "integration" ]]; then
32+
SHARED_DEPS_OVERRIDE=3.45.2-SNAPSHOT
33+
fi
34+
if [ -n "${SHARED_DEPS_OVERRIDE}" ]; then
35+
echo "Account used for Artifact Registry authentication"
36+
echo "gcloud config get-value core/account:"
37+
gcloud config get-value core/account
38+
echo "wget a file from Artifact Registry:"
39+
wget --quiet --header="Authorization: Bearer $(gcloud auth print-access-token)" \
40+
--output-document=/dev/null \
41+
https://us-maven.pkg.dev/suztomo-cloud-function-test/test-maven-repo/com/google/cloud/google-cloud-shared-dependencies/3.45.2-latest-deps-2024-0418-102802/google-cloud-shared-dependencies-3.45.2-latest-deps-2024-0418-102802.pom
42+
43+
# Tell the integration tests to use the specific shared dependencies available in the snapshot repository.
44+
INTEGRATION_TEST_ARGS="${INTEGRATION_TEST_ARGS} -Dgoogle-cloud-shared-dependencies.version=${SHARED_DEPS_OVERRIDE} -Puse-snapshot-repo"
45+
echo "Showing dependency tree"
46+
mvn -B ${INTEGRATION_TEST_ARGS} -ntp dependency:tree
47+
echo "End of dependency tree"
48+
fi
49+
50+
mvn install -B -V -ntp \
51+
${INTEGRATION_TEST_ARGS}
52+
-DskipTests=true \
53+
-Dclirr.skip=true \
54+
-Denforcer.skip=true \
55+
-Dcheckstyle.skip=true \
56+
-Dmaven.javadoc.skip=true \
57+
-Dgcloud.download.skip=true \
58+
-T 1C
59+
60+
echo "mvn instal succeeded"
4061

4162
# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it
4263
if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then

.mvn/extensions.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
3+
<!-- Extension to allow us to use the "artifactregistry://" URL scheme -->
4+
<extension>
5+
<groupId>com.google.cloud.artifactregistry</groupId>
6+
<artifactId>artifactregistry-maven-wagon</artifactId>
7+
<version>2.2.5</version>
8+
</extension>
9+
</extensions>
10+

pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,21 @@
365365
</plugins>
366366
</build>
367367
</profile>
368+
<profile>
369+
<id>use-snapshot-repo</id>
370+
<repositories>
371+
<repository>
372+
<id>artifact-registry</id>
373+
<url>artifactregistry://us-maven.pkg.dev/suztomo-cloud-function-test/test-maven-repo-snapshot</url>
374+
<releases>
375+
<enabled>true</enabled>
376+
</releases>
377+
<snapshots>
378+
<enabled>true</enabled>
379+
</snapshots>
380+
</repository>
381+
</repositories>
382+
</profile>
368383
</profiles>
369384

370385
<modules>

0 commit comments

Comments
 (0)