Skip to content

Commit 1624d55

Browse files
chore: update common templates (#1035)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * ci: add dependency list completeness check (#490) Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Mon Apr 13 18:30:27 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 3df869dd6eb546ef13beeb7a9efa6ee0226afafd Source-Link: googleapis/synthtool@3df869d * build(java): set GOOGLE_CLOUD_PROJECT env for samples/integration tests (#484) * build(java): set GOOGLE_CLOUD_PROJECT env variable for samples/integration tests * ci: use java-docs-samples-testing for sample tests Source-Author: Jeff Ching <chingor@google.com> Source-Date: Mon Apr 13 16:24:21 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 52638600f387deb98efb5f9c85fec39e82aa9052 Source-Link: googleapis/synthtool@5263860
1 parent 075ca59 commit 1624d55

File tree

11 files changed

+94
-19
lines changed

11 files changed

+94
-19
lines changed

.kokoro/common.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ function retry_with_backoff {
5252

5353
return $exit_code
5454
}
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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,51 @@ retry_with_backoff 3 10 \
3636
-Dclirr.skip=true
3737

3838
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/nightly/integration.cfg

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,25 @@ env_vars: {
1010
key: "JOB_TYPE"
1111
value: "integration"
1212
}
13-
13+
# TODO: remove this after we've migrated all tests and scripts
1414
env_vars: {
1515
key: "GCLOUD_PROJECT"
1616
value: "gcloud-devel"
1717
}
1818

19+
env_vars: {
20+
key: "GOOGLE_CLOUD_PROJECT"
21+
value: "gcloud-devel"
22+
}
23+
1924
env_vars: {
2025
key: "ENABLE_BUILD_COP"
2126
value: "true"
2227
}
2328

2429
env_vars: {
25-
key: "GOOGLE_APPLICATION_CREDENTIALS"
26-
value: "keystore/73713_java_it_service_account"
30+
key: "GOOGLE_APPLICATION_CREDENTIALS"
31+
value: "keystore/73713_java_it_service_account"
2732
}
2833

2934
before_action {

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

samples/install-without-bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>com.google.cloud.samples</groupId>
1616
<artifactId>shared-configuration</artifactId>
17-
<version>1.0.17</version>
17+
<version>1.0.12</version>
1818
</parent>
1919

2020
<properties>

samples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<parent>
1919
<groupId>com.google.cloud.samples</groupId>
2020
<artifactId>shared-configuration</artifactId>
21-
<version>1.0.17</version>
21+
<version>1.0.15</version>
2222
</parent>
2323

2424
<properties>

samples/snapshot/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>com.google.cloud.samples</groupId>
1616
<artifactId>shared-configuration</artifactId>
17-
<version>1.0.17</version>
17+
<version>1.0.12</version>
1818
</parent>
1919

2020
<properties>

samples/snippets/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>com.google.cloud.samples</groupId>
1616
<artifactId>shared-configuration</artifactId>
17-
<version>1.0.17</version>
17+
<version>1.0.12</version>
1818
</parent>
1919

2020
<properties>

0 commit comments

Comments
 (0)