Skip to content

Commit fd4a02a

Browse files
ci(spanner): use airlock for fetching dependencies
1 parent 3f4873d commit fd4a02a

File tree

6 files changed

+258
-3
lines changed

6 files changed

+258
-3
lines changed

.kokoro/build.sh

Lines changed: 9 additions & 1 deletion
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,15 @@ fi
3335
mvn -version
3436
echo ${JOB_TYPE}
3537

38+
INSTALL_OPTS=""
39+
if [[ $ENABLE_AIRLOCK = 'true' ]]; then
40+
INSTALL_OPTS="-Pairlock-trusted"
41+
fi
42+
3643
# attempt to install 3 times with exponential backoff (starting with 10 seconds)
3744
retry_with_backoff 3 10 \
38-
mvn install -B -V -ntp \
45+
mvn install -B -V \
46+
${INSTALL_OPTS} \
3947
-DskipTests=true \
4048
-Dclirr.skip=true \
4149
-Denforcer.skip=true \

.kokoro/dependencies.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
set -eo pipefail
1717
shopt -s nullglob
1818

19+
set -x
20+
1921
## Get the directory of the build script
2022
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
2123
## cd to the parent directory, i.e. the root of the git repo
@@ -53,9 +55,15 @@ if [ ! -z "${JAVA11_HOME}" ]; then
5355
setJava "${JAVA11_HOME}"
5456
fi
5557

58+
INSTALL_OPTS=""
59+
if [[ $ENABLE_AIRLOCK = 'true' ]]; then
60+
INSTALL_OPTS="-Pairlock-trusted"
61+
fi
62+
5663
# this should run maven enforcer
5764
retry_with_backoff 3 10 \
58-
mvn install -B -V -ntp \
65+
mvn install -B -V \
66+
${INSTALL_OPTS} \
5967
-DskipTests=true \
6068
-Dmaven.javadoc.skip=true \
6169
-Dclirr.skip=true
@@ -64,4 +72,4 @@ if [ ! -z "${JAVA8_HOME}" ]; then
6472
setJava "${JAVA8_HOME}"
6573
fi
6674

67-
mvn -B dependency:analyze -DfailOnWarning=true
75+
mvn -B ${INSTALL_OPTS} dependency:analyze -DfailOnWarning=true

.kokoro/presubmit/dependencies.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ env_vars: {
1010
key: "TRAMPOLINE_BUILD_FILE"
1111
value: "github/java-spanner/.kokoro/dependencies.sh"
1212
}
13+
14+
env_vars: {
15+
key: "ENABLE_AIRLOCK",
16+
value: "true"
17+
}

.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>

google-cloud-spanner-bom/pom.xml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,117 @@
119119
</plugin>
120120
</plugins>
121121
</build>
122+
123+
<profiles>
124+
<profile>
125+
<!-- Profile to use Airlock (go/airlock/howto_maven). Disabled by default. -->
126+
<id>airlock-trusted</id>
127+
<pluginRepositories>
128+
<pluginRepository>
129+
<id>airlock</id>
130+
<name>Airlock</name>
131+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
132+
<layout>default</layout>
133+
<releases>
134+
<enabled>true</enabled>
135+
</releases>
136+
<snapshots>
137+
<enabled>true</enabled>
138+
</snapshots>
139+
</pluginRepository>
140+
<!-- Adding a fallback to airlock 3p staging till all the license verification issues are resolved -->
141+
<pluginRepository>
142+
<id>airlock-staging</id>
143+
<name>Airlock</name>
144+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven</url>
145+
<layout>default</layout>
146+
<releases>
147+
<enabled>true</enabled>
148+
</releases>
149+
<snapshots>
150+
<enabled>true</enabled>
151+
</snapshots>
152+
</pluginRepository>
153+
<pluginRepository>
154+
<id>central</id>
155+
<!-- Disable default Maven Central -->
156+
<name>Maven Central remote repository</name>
157+
<url>https://repo.maven.apache.org/maven2</url>
158+
<layout>default</layout>
159+
<releases>
160+
<enabled>false</enabled>
161+
</releases>
162+
<snapshots>
163+
<enabled>false</enabled>
164+
</snapshots>
165+
</pluginRepository>
166+
<pluginRepository>
167+
<id>rso-public-grid</id>
168+
<!-- Disable default sonatype public grid -->
169+
<name>Maven Central Sonatype repository</name>
170+
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
171+
<layout>default</layout>
172+
<releases>
173+
<enabled>false</enabled>
174+
</releases>
175+
<snapshots>
176+
<enabled>false</enabled>
177+
</snapshots>
178+
</pluginRepository>
179+
</pluginRepositories>
180+
<repositories>
181+
<repository>
182+
<id>airlock</id>
183+
<name>Airlock</name>
184+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p-trusted</url>
185+
<layout>default</layout>
186+
<releases>
187+
<enabled>true</enabled>
188+
</releases>
189+
<snapshots>
190+
<enabled>true</enabled>
191+
</snapshots>
192+
</repository>
193+
<!-- Adding a fallback to airlock 3p staging till all the license verification issues are resolved -->
194+
<repository>
195+
<id>airlock-staging</id>
196+
<name>Airlock</name>
197+
<url>artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/ah-3p-staging-maven</url>
198+
<layout>default</layout>
199+
<releases>
200+
<enabled>true</enabled>
201+
</releases>
202+
<snapshots>
203+
<enabled>true</enabled>
204+
</snapshots>
205+
</repository>
206+
<repository>
207+
<id>central</id>
208+
<!-- Disable default Maven Central -->
209+
<name>Maven Central remote repository</name>
210+
<url>https://repo.maven.apache.org/maven2</url>
211+
<layout>default</layout>
212+
<releases>
213+
<enabled>false</enabled>
214+
</releases>
215+
<snapshots>
216+
<enabled>false</enabled>
217+
</snapshots>
218+
</repository>
219+
<repository>
220+
<id>rso-public-grid</id>
221+
<!-- Disable default sonatype public grid -->
222+
<name>Maven Central Sonatype repository</name>
223+
<url>https://repository.sonatype.org/content/groups/sonatype-public-grid</url>
224+
<layout>default</layout>
225+
<releases>
226+
<enabled>false</enabled>
227+
</releases>
228+
<snapshots>
229+
<enabled>false</enabled>
230+
</snapshots>
231+
</repository>
232+
</repositories>
233+
</profile>
234+
</profiles>
122235
</project>

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)