Skip to content

Commit 75b06b8

Browse files
ci(spanner): use airlock for fetching dependencies
1 parent ed0ad28 commit 75b06b8

File tree

4 files changed

+137
-0
lines changed

4 files changed

+137
-0
lines changed

.kokoro/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
set -eo pipefail
1717

18+
set -x
19+
1820
## Get the directory of the build script
1921
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
2022
## cd to the parent directory, i.e. the root of the git repo
@@ -33,9 +35,16 @@ fi
3335
mvn -version
3436
echo ${JOB_TYPE}
3537

38+
# Enable airlock only for Kokoro jobs
39+
INSTALL_OPTS=""
40+
if [[ ! -z "${KOKORO_JOB_TYPE}" && ${KOKORO_JOB_TYPE} =~ ^.*presubmit.*$ ]]; then
41+
INSTALL_OPTS="-Pairlock-trusted"
42+
fi
43+
3644
# attempt to install 3 times with exponential backoff (starting with 10 seconds)
3745
retry_with_backoff 3 10 \
3846
mvn install -B -V -ntp \
47+
${INSTALL_OPTS} \
3948
-DskipTests=true \
4049
-Dclirr.skip=true \
4150
-Denforcer.skip=true \

.kokoro/dependencies.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ if [ ! -z "${JAVA11_HOME}" ]; then
5353
setJava "${JAVA11_HOME}"
5454
fi
5555

56+
# Enable airlock only for Kokoro jobs
57+
INSTALL_OPTS=""
58+
if [[ ! -z "${KOKORO_JOB_TYPE}" ]]; then
59+
INSTALL_OPTS="-Pairlock-trusted"
60+
fi
61+
5662
# this should run maven enforcer
5763
retry_with_backoff 3 10 \
5864
mvn install -B -V -ntp \
65+
${INSTALL_OPTS} \
5966
-DskipTests=true \
6067
-Dmaven.javadoc.skip=true \
6168
-Dclirr.skip=true

.mvn/extensions.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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>
4+
<groupId>com.google.cloud.artifactregistry</groupId>
5+
<artifactId>artifactregistry-maven-wagon</artifactId>
6+
<version>2.2.3</version>
7+
</extension>
8+
</extensions>

pom.xml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,117 @@
234234
</plugin>
235235
</plugins>
236236
</reporting>
237+
238+
<profiles>
239+
<profile>
240+
<!-- Profile to use Airlock (go/airlock/howto_maven). Disabled by default. -->
241+
<id>airlock-trusted</id>
242+
<pluginRepositories>
243+
<pluginRepository>
244+
<id>airlock</id>
245+
<name>Airlock</name>
246+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
247+
<layout>default</layout>
248+
<releases>
249+
<enabled>true</enabled>
250+
</releases>
251+
<snapshots>
252+
<enabled>true</enabled>
253+
</snapshots>
254+
</pluginRepository>
255+
<!-- Adding a fallback to airlock 3p staging till all the license verification issues are resolved -->
256+
<pluginRepository>
257+
<id>airlock-staging</id>
258+
<name>Airlock</name>
259+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven</url>
260+
<layout>default</layout>
261+
<releases>
262+
<enabled>true</enabled>
263+
</releases>
264+
<snapshots>
265+
<enabled>true</enabled>
266+
</snapshots>
267+
</pluginRepository>
268+
<pluginRepository>
269+
<id>central</id>
270+
<!-- Disable default Maven Central -->
271+
<name>Maven Central remote repository</name>
272+
<url>https://repo.maven.apache.org/maven2</url>
273+
<layout>default</layout>
274+
<releases>
275+
<enabled>false</enabled>
276+
</releases>
277+
<snapshots>
278+
<enabled>false</enabled>
279+
</snapshots>
280+
</pluginRepository>
281+
<pluginRepository>
282+
<id>rso-public-grid</id>
283+
<!-- Disable default sonatype public grid -->
284+
<name>Maven Central Sonatype repository</name>
285+
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
286+
<layout>default</layout>
287+
<releases>
288+
<enabled>false</enabled>
289+
</releases>
290+
<snapshots>
291+
<enabled>false</enabled>
292+
</snapshots>
293+
</pluginRepository>
294+
</pluginRepositories>
295+
<repositories>
296+
<repository>
297+
<id>airlock</id>
298+
<name>Airlock</name>
299+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
300+
<layout>default</layout>
301+
<releases>
302+
<enabled>true</enabled>
303+
</releases>
304+
<snapshots>
305+
<enabled>true</enabled>
306+
</snapshots>
307+
</repository>
308+
<!-- Adding a fallback to airlock 3p staging till all the license verification issues are resolved -->
309+
<repository>
310+
<id>airlock-staging</id>
311+
<name>Airlock</name>
312+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven</url>
313+
<layout>default</layout>
314+
<releases>
315+
<enabled>true</enabled>
316+
</releases>
317+
<snapshots>
318+
<enabled>true</enabled>
319+
</snapshots>
320+
</repository>
321+
<repository>
322+
<id>central</id>
323+
<!-- Disable default Maven Central -->
324+
<name>Maven Central remote repository</name>
325+
<url>https://repo.maven.apache.org/maven2</url>
326+
<layout>default</layout>
327+
<releases>
328+
<enabled>false</enabled>
329+
</releases>
330+
<snapshots>
331+
<enabled>false</enabled>
332+
</snapshots>
333+
</repository>
334+
<repository>
335+
<id>rso-public-grid</id>
336+
<!-- Disable default sonatype public grid -->
337+
<name>Maven Central Sonatype repository</name>
338+
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
339+
<layout>default</layout>
340+
<releases>
341+
<enabled>false</enabled>
342+
</releases>
343+
<snapshots>
344+
<enabled>false</enabled>
345+
</snapshots>
346+
</repository>
347+
</repositories>
348+
</profile>
349+
</profiles>
237350
</project>

0 commit comments

Comments
 (0)