Skip to content

Commit 193fecd

Browse files
authored
chore: regenerate common templates (#1067)
* chore: regenerate common templates * chore: keep codeowner_team
1 parent b1353f8 commit 193fecd

File tree

14 files changed

+101
-53
lines changed

14 files changed

+101
-53
lines changed

.github/CODEOWNERS

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
* @googleapis/yoshi-java
1+
# Code owners file.
2+
# This file controls who is tagged for review for any given pull request.
3+
4+
# For syntax help see:
5+
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
6+
7+
# The @googleapis/yoshi-java is the default owner for changes in this repo
8+
**/*.java @googleapis/yoshi-java
9+
10+
# The java-samples-reviewers team is the default owner for samples changes
11+
samples/**/*.java @googleapis/java-samples-reviewers

.github/workflows/ci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ jobs:
3636
JOB_TYPE: test
3737
dependencies:
3838
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
java: [8, 11]
3942
steps:
4043
- uses: actions/checkout@v2
4144
- uses: actions/setup-java@v1
4245
with:
43-
java-version: 8
46+
java-version: ${{matrix.java}}
4447
- run: java -version
4548
- run: .kokoro/dependencies.sh
4649
linkage-monitor:

.kokoro/build.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ retry_with_backoff 3 10 \
3939

4040
# if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it
4141
if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then
42-
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_ROOT}/src/${GOOGLE_APPLICATION_CREDENTIALS})
42+
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS})
4343
fi
4444

4545
RETURN_CODE=0
@@ -51,9 +51,7 @@ test)
5151
RETURN_CODE=$?
5252
;;
5353
lint)
54-
mvn \
55-
-Penable-samples \
56-
com.coveo:fmt-maven-plugin:check
54+
mvn com.coveo:fmt-maven-plugin:check
5755
RETURN_CODE=$?
5856
;;
5957
javadoc)

.kokoro/dependencies.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************"
4141
## Run dependency list completeness check
4242
function completenessCheck() {
4343
# Output dep list with compile scope generated using the original pom
44+
# Running mvn dependency:list on Java versions that support modules will also include the module of the dependency.
45+
# This is stripped from the output as it is not present in the flattened pom.
4446
msg "Generating dependency list using original pom..."
45-
mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | grep -v ':test$' >.org-list.txt
47+
mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e s/\\s--\\smodule.*// | grep -v ':test$' >.org-list.txt
4648

4749
# Output dep list generated using the flattened pom (test scope deps are ommitted)
4850
msg "Generating dependency list using flattened pom..."

.kokoro/nightly/integration.cfg

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@ env_vars: {
2828

2929
env_vars: {
3030
key: "GOOGLE_APPLICATION_CREDENTIALS"
31-
value: "keystore/73713_java_it_service_account"
31+
value: "secret_manager/java-it-service-account"
3232
}
3333

34-
before_action {
35-
fetch_keystore {
36-
keystore_resource {
37-
keystore_config_id: 73713
38-
keyname: "java_it_service_account"
39-
}
40-
}
34+
env_vars: {
35+
key: "SECRET_MANAGER_KEYS"
36+
value: "java-it-service-account"
4137
}

.kokoro/nightly/samples.cfg

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,15 @@ env_vars: {
2424

2525
env_vars: {
2626
key: "GOOGLE_APPLICATION_CREDENTIALS"
27-
value: "keystore/73713_java_it_service_account"
27+
value: "secret_manager/java-docs-samples-service-account"
2828
}
2929

3030
env_vars: {
31-
key: "ENABLE_BUILD_COP"
32-
value: "true"
31+
key: "SECRET_MANAGER_KEYS"
32+
value: "java-docs-samples-service-account"
3333
}
3434

35-
before_action {
36-
fetch_keystore {
37-
keystore_resource {
38-
keystore_config_id: 73713
39-
keyname: "java_it_service_account"
40-
}
41-
}
35+
env_vars: {
36+
key: "ENABLE_BUILD_COP"
37+
value: "true"
4238
}

.kokoro/populate-secrets.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
19+
function msg { println "$*" >&2 ;}
20+
function println { printf '%s\n' "$(now) $*" ;}
21+
22+
23+
# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
24+
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
25+
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
26+
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
27+
mkdir -p ${SECRET_LOCATION}
28+
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
29+
do
30+
msg "Retrieving secret ${key}"
31+
docker run --entrypoint=gcloud \
32+
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
33+
gcr.io/google.com/cloudsdktool/cloud-sdk \
34+
secrets versions access latest \
35+
--project cloud-devrel-kokoro-resources \
36+
--secret ${key} > \
37+
"${SECRET_LOCATION}/${key}"
38+
if [[ $? == 0 ]]; then
39+
msg "Secret written to ${SECRET_LOCATION}/${key}"
40+
else
41+
msg "Error retrieving secret ${key}"
42+
fi
43+
done

.kokoro/presubmit/integration.cfg

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ env_vars: {
2424

2525
env_vars: {
2626
key: "GOOGLE_APPLICATION_CREDENTIALS"
27-
value: "keystore/73713_java_it_service_account"
27+
value: "secret_manager/java-it-service-account"
2828
}
2929

30-
before_action {
31-
fetch_keystore {
32-
keystore_resource {
33-
keystore_config_id: 73713
34-
keyname: "java_it_service_account"
35-
}
36-
}
30+
env_vars: {
31+
key: "SECRET_MANAGER_KEYS"
32+
value: "java-it-service-account"
3733
}

.kokoro/presubmit/samples.cfg

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ env_vars: {
2424

2525
env_vars: {
2626
key: "GOOGLE_APPLICATION_CREDENTIALS"
27-
value: "keystore/73713_java_it_service_account"
27+
value: "secret_manager/java-docs-samples-service-account"
2828
}
2929

30-
before_action {
31-
fetch_keystore {
32-
keystore_resource {
33-
keystore_config_id: 73713
34-
keyname: "java_it_service_account"
35-
}
36-
}
37-
}
30+
env_vars: {
31+
key: "SECRET_MANAGER_KEYS"
32+
value: "java-docs-samples-service-account"
33+
}

.kokoro/trampoline.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ function cleanup() {
2121
echo "cleanup";
2222
}
2323
trap cleanup EXIT
24+
25+
$(dirname $0)/populate-secrets.sh # Secret Manager secrets.
2426
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"

.repo-metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"language": "java",
77
"repo": "googleapis/google-http-java-client",
88
"repo_short": "google-http-java-client",
9+
"codeowner_team": "@googleapis/yoshi-java",
910
"distribution_name": "com.google.http-client:google-http-client"
1011
}

CONTRIBUTING.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,16 @@ mvn -Penable-samples clean verify
9999
```
100100

101101
2. [Activate](#profile-activation) the profile.
102-
3. Define your samples in a normal Maven project in the `samples/` directory
102+
3. Define your samples in a normal Maven project in the `samples/` directory.
103+
104+
### Code Formatting
105+
106+
Code in this repo is formatted with
107+
[google-java-format](https://github.com/google/google-java-format).
108+
To run formatting on your project, you can run:
109+
```
110+
mvn com.coveo:fmt-maven-plugin:format
111+
```
103112

104113
### Profile Activation
105114

synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
{
44
"git": {
55
"name": ".",
6-
"remote": "https://github.com/googleapis/google-http-java-client.git",
7-
"sha": "1624d55f9864ff1253321e9bfe715e2f370cc27e"
6+
"remote": "git@github.com:chingor13/google-http-java-client.git",
7+
"sha": "b1353f8cc7aaf22a30b31bd2ac72248d3a3a0a5d"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "synthtool",
1313
"remote": "https://github.com/googleapis/synthtool.git",
14-
"sha": "98c50772ec23295c64cf0d2ddf199ea52961fd4c"
14+
"sha": "ce68c0e70d36c93ffcde96e9908fb4d94aa4f2e4"
1515
}
1616
}
1717
]

synth.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""This script is used to synthesize generated parts of this library."""
15-
import synthtool as s
16-
import synthtool.gcp as gcp
17-
import logging
1815

19-
logging.basicConfig(level=logging.DEBUG)
20-
common_templates = gcp.CommonTemplates()
21-
templates = common_templates.java_library()
22-
s.copy(templates, excludes=[
16+
import synthtool.languages.java as java
17+
18+
java.common_templates(excludes=[
2319
"README.md",
2420
"java.header",
2521
"checkstyle.xml",

0 commit comments

Comments
 (0)