Skip to content
This repository was archived by the owner on Dec 3, 2023. It is now read-only.

Commit e1618ba

Browse files
chore: update common templates (#196)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/f193fffb-af3a-401a-a8ed-2548fbd8844c/targets
1 parent 2b1bd0d commit e1618ba

File tree

6 files changed

+91
-25
lines changed

6 files changed

+91
-25
lines changed

.kokoro/build.sh

+12-7
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,22 @@ scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
2020
## cd to the parent directory, i.e. the root of the git repo
2121
cd ${scriptDir}/..
2222

23+
# include common functions
24+
source ${scriptDir}/common.sh
25+
2326
# Print out Java version
2427
java -version
2528
echo ${JOB_TYPE}
2629

27-
mvn install -B -V \
28-
-DskipTests=true \
29-
-Dclirr.skip=true \
30-
-Denforcer.skip=true \
31-
-Dmaven.javadoc.skip=true \
32-
-Dgcloud.download.skip=true \
33-
-T 1C
30+
# attempt to install 3 times with exponential backoff (starting with 10 seconds)
31+
retry_with_backoff 3 10 \
32+
mvn install -B -V \
33+
-DskipTests=true \
34+
-Dclirr.skip=true \
35+
-Denforcer.skip=true \
36+
-Dmaven.javadoc.skip=true \
37+
-Dgcloud.download.skip=true \
38+
-T 1C
3439

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

.kokoro/common.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# set -eo pipefail
17+
18+
function retry_with_backoff {
19+
attempts_left=$1
20+
sleep_seconds=$2
21+
shift 2
22+
command=$@
23+
24+
echo "${command}"
25+
${command}
26+
exit_code=$?
27+
28+
if [[ $exit_code == 0 ]]
29+
then
30+
return 0
31+
fi
32+
33+
# failure
34+
if [[ ${attempts_left} > 0 ]]
35+
then
36+
echo "failure (${exit_code}), sleeping ${sleep_seconds}..."
37+
sleep ${sleep_seconds}
38+
new_attempts=$((${attempts_left} - 1))
39+
new_sleep=$((${sleep_seconds} * 2))
40+
retry_with_backoff ${new_attempts} ${new_sleep} ${command}
41+
fi
42+
43+
return $exit_code
44+
}

.kokoro/dependencies.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515

1616
set -eo pipefail
1717

18-
cd github/java-core/
18+
## Get the directory of the build script
19+
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
20+
## cd to the parent directory, i.e. the root of the git repo
21+
cd ${scriptDir}/..
22+
23+
# include common functions
24+
source ${scriptDir}/common.sh
1925

2026
# Print out Java
2127
java -version
@@ -24,8 +30,9 @@ echo $JOB_TYPE
2430
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"
2531

2632
# this should run maven enforcer
27-
mvn install -B -V \
28-
-DskipTests=true \
29-
-Dclirr.skip=true
33+
retry_with_backoff 3 10 \
34+
mvn install -B -V \
35+
-DskipTests=true \
36+
-Dclirr.skip=true
3037

3138
mvn -B dependency:analyze -DfailOnWarning=true

.kokoro/linkage-monitor.sh

+15-7
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,26 @@ set -eo pipefail
1717
# Display commands being run.
1818
set -x
1919

20-
cd github/java-core/
20+
## Get the directory of the build script
21+
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
22+
## cd to the parent directory, i.e. the root of the git repo
23+
cd ${scriptDir}/..
24+
25+
# include common functions
26+
source ${scriptDir}/common.sh
2127

2228
# Print out Java version
2329
java -version
2430
echo ${JOB_TYPE}
2531

26-
mvn install -B -V \
27-
-DskipTests=true \
28-
-Dclirr.skip=true \
29-
-Denforcer.skip=true \
30-
-Dmaven.javadoc.skip=true \
31-
-Dgcloud.download.skip=true
32+
# attempt to install 3 times with exponential backoff (starting with 10 seconds)
33+
retry_with_backoff 3 10 \
34+
mvn install -B -V \
35+
-DskipTests=true \
36+
-Dclirr.skip=true \
37+
-Denforcer.skip=true \
38+
-Dmaven.javadoc.skip=true \
39+
-Dgcloud.download.skip=true
3240

3341
# Kokoro job cloud-opensource-java/ubuntu/linkage-monitor-gcs creates this JAR
3442
JAR=linkage-monitor-latest-all-deps.jar

renovate.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@
5656
},
5757
{
5858
"packagePatterns": [
59-
"^com.google.cloud:libraries-bom"
59+
"^com.google.cloud:google-cloud-core",
60+
"^com.google.cloud:libraries-bom",
61+
"^com.google.cloud.samples:shared-configuration"
6062
],
6163
"semanticCommitType": "chore",
6264
"semanticCommitScope": "deps"
@@ -75,4 +77,4 @@
7577
}
7678
],
7779
"semanticCommits": true
78-
}
80+
}

synth.metadata

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"updateTime": "2020-03-17T19:21:17.805286Z",
2+
"updateTime": "2020-03-25T23:35:19.763220Z",
33
"sources": [
44
{
5-
"template": {
6-
"name": "java_library",
7-
"origin": "synthtool.gcp",
8-
"version": "2020.2.4"
5+
"git": {
6+
"name": "synthtool",
7+
"remote": "https://github.com/googleapis/synthtool.git",
8+
"sha": "e36822bfa0acb355502dab391b8ef9c4f30208d8"
99
}
1010
}
1111
]

0 commit comments

Comments
 (0)