Skip to content

Commit 04991f0

Browse files
Change triggered by none of the following:
This git repo (https://github.com/googleapis/java-logging.git) Git repo https://github.com/googleapis/googleapis.git
1 parent 8c261a0 commit 04991f0

File tree

13 files changed

+320
-59
lines changed

13 files changed

+320
-59
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for context and/or discussion)
1+
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
2+
- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-logging/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
3+
- [ ] Ensure the tests and linter pass
4+
- [ ] Code coverage does not decrease (if any source code was changed)
5+
- [ ] Appropriate docs were updated (if necessary)
6+
7+
Fixes #<issue_number_goes_here> ☕️

.kokoro/build.sh

Lines changed: 12 additions & 7 deletions
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

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
function retry_with_backoff {
17+
attempts_left=$1
18+
sleep_seconds=$2
19+
shift 2
20+
command=$@
21+
22+
23+
# store current flag state
24+
flags=$-
25+
26+
# allow a failures to continue
27+
set +e
28+
echo "${command}"
29+
${command}
30+
exit_code=$?
31+
32+
# restore "e" flag
33+
if [[ ${flags} =~ e ]]
34+
then set -e
35+
else set +e
36+
fi
37+
38+
if [[ $exit_code == 0 ]]
39+
then
40+
return 0
41+
fi
42+
43+
# failure
44+
if [[ ${attempts_left} > 0 ]]
45+
then
46+
echo "failure (${exit_code}), sleeping ${sleep_seconds}..."
47+
sleep ${sleep_seconds}
48+
new_attempts=$((${attempts_left} - 1))
49+
new_sleep=$((${sleep_seconds} * 2))
50+
retry_with_backoff ${new_attempts} ${new_sleep} ${command}
51+
fi
52+
53+
return $exit_code
54+
}
55+
56+
## Helper functionss
57+
function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; }
58+
function msg() { println "$*" >&2; }
59+
function println() { printf '%s\n' "$(now) $*"; }

.kokoro/dependencies.sh

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515

1616
set -eo pipefail
1717

18-
cd github/java-logging/
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,57 @@ 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
39+
40+
echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************"
41+
## Run dependency list completeness check
42+
function completenessCheck() {
43+
# Output dep list with compile scope generated using the original pom
44+
msg "Generating dependency list using original pom..."
45+
mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | grep -v ':test$' >.org-list.txt
46+
47+
# Output dep list generated using the flattened pom (test scope deps are ommitted)
48+
msg "Generating dependency list using flattened pom..."
49+
mvn dependency:list -f .flattened-pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt
50+
51+
# Compare two dependency lists
52+
msg "Comparing dependency lists..."
53+
diff .org-list.txt .new-list.txt >.diff.txt
54+
if [[ $? == 0 ]]
55+
then
56+
msg "Success. No diff!"
57+
else
58+
msg "Diff found. See below: "
59+
msg "You can also check .diff.txt file located in $1."
60+
cat .diff.txt
61+
return 1
62+
fi
63+
}
64+
65+
# Allow failures to continue running the script
66+
set +e
67+
68+
error_count=0
69+
for path in $(find -name ".flattened-pom.xml")
70+
do
71+
# Check flattened pom in each dir that contains it for completeness
72+
dir=$(dirname "$path")
73+
pushd "$dir"
74+
completenessCheck "$dir"
75+
error_count=$(($error_count + $?))
76+
popd
77+
done
78+
79+
if [[ $error_count == 0 ]]
80+
then
81+
msg "All checks passed."
82+
exit 0
83+
else
84+
msg "Errors found. See log statements above."
85+
exit 1
86+
fi

.kokoro/linkage-monitor.sh

Lines changed: 15 additions & 7 deletions
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-logging/
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

.kokoro/nightly/integration.cfg

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,31 @@ env_vars: {
66
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
77
}
88

9+
env_vars: {
10+
key: "JOB_TYPE"
11+
value: "integration"
12+
}
13+
# TODO: remove this after we've migrated all tests and scripts
14+
env_vars: {
15+
key: "GCLOUD_PROJECT"
16+
value: "gcloud-devel"
17+
}
18+
19+
env_vars: {
20+
key: "GOOGLE_CLOUD_PROJECT"
21+
value: "gcloud-devel"
22+
}
23+
924
env_vars: {
1025
key: "ENABLE_BUILD_COP"
1126
value: "true"
1227
}
1328

29+
env_vars: {
30+
key: "GOOGLE_APPLICATION_CREDENTIALS"
31+
value: "keystore/73713_java_it_service_account"
32+
}
33+
1434
before_action {
1535
fetch_keystore {
1636
keystore_resource {

.kokoro/nightly/samples.cfg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ env_vars: {
1111
value: "samples"
1212
}
1313

14+
# TODO: remove this after we've migrated all tests and scripts
1415
env_vars: {
1516
key: "GCLOUD_PROJECT"
16-
value: "gcloud-devel"
17+
value: "java-docs-samples-testing"
18+
}
19+
20+
env_vars: {
21+
key: "GOOGLE_CLOUD_PROJECT"
22+
value: "java-docs-samples-testing"
1723
}
1824

1925
env_vars: {

.kokoro/presubmit/integration.cfg

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@ env_vars: {
1111
value: "integration"
1212
}
1313

14+
# TODO: remove this after we've migrated all tests and scripts
1415
env_vars: {
15-
key: "GCLOUD_PROJECT"
16-
value: "gcloud-devel"
16+
key: "GCLOUD_PROJECT"
17+
value: "gcloud-devel"
1718
}
1819

1920
env_vars: {
20-
key: "GOOGLE_APPLICATION_CREDENTIALS"
21-
value: "keystore/73713_java_it_service_account"
21+
key: "GOOGLE_CLOUD_PROJECT"
22+
value: "gcloud-devel"
23+
}
24+
25+
env_vars: {
26+
key: "GOOGLE_APPLICATION_CREDENTIALS"
27+
value: "keystore/73713_java_it_service_account"
2228
}
2329

2430
before_action {

.kokoro/presubmit/samples.cfg

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@ env_vars: {
1111
value: "samples"
1212
}
1313

14+
# TODO: remove this after we've migrated all tests and scripts
1415
env_vars: {
15-
key: "GCLOUD_PROJECT"
16-
value: "gcloud-devel"
16+
key: "GCLOUD_PROJECT"
17+
value: "java-docs-samples-testing"
1718
}
1819

1920
env_vars: {
20-
key: "GOOGLE_APPLICATION_CREDENTIALS"
21-
value: "keystore/73713_java_it_service_account"
21+
key: "GOOGLE_CLOUD_PROJECT"
22+
value: "java-docs-samples-testing"
23+
}
24+
25+
env_vars: {
26+
key: "GOOGLE_APPLICATION_CREDENTIALS"
27+
value: "keystore/73713_java_it_service_account"
2228
}
2329

2430
before_action {

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,40 @@ Java idiomatic client for [Stackdriver Logging][product-docs].
1212

1313
If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
1414
```xml
15-
<dependencyManagement>
16-
<dependencies>
17-
<dependency>
18-
<groupId>com.google.cloud</groupId>
19-
<artifactId>libraries-bom</artifactId>
20-
<version>4.1.1</version>
21-
<type>pom</type>
22-
<scope>import</scope>
23-
</dependency>
24-
</dependencies>
25-
</dependencyManagement>
26-
15+
<dependencyManagement>
2716
<dependencies>
2817
<dependency>
2918
<groupId>com.google.cloud</groupId>
30-
<artifactId>google-cloud-logging</artifactId>
19+
<artifactId>libraries-bom</artifactId>
20+
<version>4.1.1</version>
21+
<type>pom</type>
22+
<scope>import</scope>
3123
</dependency>
3224
</dependencies>
25+
</dependencyManagement>
3326

34-
```
27+
<dependencies>
28+
<dependency>
29+
<groupId>com.google.cloud</groupId>
30+
<artifactId>google-cloud-logging</artifactId>
31+
</dependency>
32+
</dependencies>
3533

36-
[//]: # ({x-version-update-start:google-cloud-logging:released})
34+
```
3735

3836
If you are using Maven without BOM, add this to your dependencies:
3937

4038
```xml
41-
<dependency>
42-
<groupId>com.google.cloud</groupId>
43-
<artifactId>google-cloud-logging</artifactId>
44-
<version>1.101.1</version>
45-
</dependency>
39+
<dependency>
40+
<groupId>com.google.cloud</groupId>
41+
<artifactId>google-cloud-logging</artifactId>
42+
<version>1.100.0</version>
43+
</dependency>
4644

4745
```
4846

47+
[//]: # ({x-version-update-start:google-cloud-logging:released})
48+
4949
If you are using Gradle, add this to your dependencies
5050
```Groovy
5151
compile 'com.google.cloud:google-cloud-logging:1.101.1'

0 commit comments

Comments
 (0)