Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
chore: regenerate common templates
Browse files Browse the repository at this point in the history
  • Loading branch information
chingor13 committed Sep 22, 2020
1 parent 63aca03 commit 6b08cd9
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 76 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -4,5 +4,7 @@
# For syntax help see:
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax

* @googleapis/yoshi-java

# The java-samples-reviewers team is the default owner for samples changes
samples/**/*.java @googleapis/java-samples-reviewers
69 changes: 69 additions & 0 deletions .github/workflows/auto-release.yaml
@@ -0,0 +1,69 @@
on:
pull_request:
name: auto-release
jobs:
approve:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3.0.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
debug: true
script: |
// only approve PRs from release-please[bot]
if (context.payload.pull_request.user.login !== "release-please[bot]") {
return;
}
// only approve PRs like "chore: release <release version>"
if ( !context.payload.pull_request.title.startsWith("chore: release") ) {
return;
}
// trigger auto-release when
// 1) it is a SNAPSHOT release (auto-generated post regular release)
// 2) there are dependency updates only
// 3) there are no open dependency update PRs in this repo (to avoid multiple releases)
if (
context.payload.pull_request.body.includes("Fix") ||
context.payload.pull_request.body.includes("Build") ||
context.payload.pull_request.body.includes("Documentation") ||
context.payload.pull_request.body.includes("BREAKING CHANGES") ||
context.payload.pull_request.body.includes("Features")
) {
console.log( "Not auto-releasing since it is not a dependency-update-only release." );
return;
}
const promise = github.pulls.list.endpoint({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
const open_pulls = await github.paginate(promise)
if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) {
for ( const pull of open_pulls ) {
if ( pull.title.startsWith("deps: update dependency") ) {
console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." );
return;
}
}
}
// approve release PR
await github.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Rubber stamped release!',
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
});
// attach kokoro:force-run and automerge labels
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['kokoro:force-run', 'automerge']
});
14 changes: 14 additions & 0 deletions .github/workflows/samples.yaml
@@ -0,0 +1,14 @@
on:
pull_request:
name: samples
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- name: Run checkstyle
run: mvn -P lint --quiet --batch-mode checkstyle:check
working-directory: samples/snippets
2 changes: 1 addition & 1 deletion .kokoro/build.bat
@@ -1,3 +1,3 @@
:: See documentation in type-shell-output.bat

"C:\Program Files\Git\bin\bash.exe" github/java-common-protos/.kokoro/build.sh
"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh
6 changes: 2 additions & 4 deletions .kokoro/build.sh
Expand Up @@ -39,7 +39,7 @@ retry_with_backoff 3 10 \

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

RETURN_CODE=0
Expand All @@ -51,9 +51,7 @@ test)
RETURN_CODE=$?
;;
lint)
mvn \
-Penable-samples \
com.coveo:fmt-maven-plugin:check
mvn com.coveo:fmt-maven-plugin:check
RETURN_CODE=$?
;;
javadoc)
Expand Down
11 changes: 7 additions & 4 deletions .kokoro/dependencies.sh
Expand Up @@ -41,12 +41,15 @@ echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************"
## Run dependency list completeness check
function completenessCheck() {
# Output dep list with compile scope generated using the original pom
# Running mvn dependency:list on Java versions that support modules will also include the module of the dependency.
# This is stripped from the output as it is not present in the flattened pom.
# Only dependencies with 'compile' or 'runtime' scope are included from original dependency list.
msg "Generating dependency list using original pom..."
mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | grep -v ':test$' >.org-list.txt
mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e s/\\s--\\smodule.*// >.org-list.txt

# Output dep list generated using the flattened pom (test scope deps are ommitted)
# Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes)
msg "Generating dependency list using flattened pom..."
mvn dependency:list -f .flattened-pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt
mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt

# Compare two dependency lists
msg "Comparing dependency lists..."
Expand Down Expand Up @@ -83,4 +86,4 @@ then
else
msg "Errors found. See log statements above."
exit 1
fi
fi
12 changes: 4 additions & 8 deletions .kokoro/nightly/integration.cfg
Expand Up @@ -28,14 +28,10 @@ env_vars: {

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
value: "secret_manager/java-it-service-account"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "java_it_service_account"
}
}
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}
16 changes: 6 additions & 10 deletions .kokoro/nightly/samples.cfg
Expand Up @@ -24,19 +24,15 @@ env_vars: {

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
value: "secret_manager/java-docs-samples-service-account"
}

env_vars: {
key: "ENABLE_BUILD_COP"
value: "true"
key: "SECRET_MANAGER_KEYS"
value: "java-docs-samples-service-account"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "java_it_service_account"
}
}
env_vars: {
key: "ENABLE_BUILD_COP"
value: "true"
}
12 changes: 4 additions & 8 deletions .kokoro/presubmit/integration.cfg
Expand Up @@ -24,14 +24,10 @@ env_vars: {

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
value: "secret_manager/java-it-service-account"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "java_it_service_account"
}
}
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}
14 changes: 5 additions & 9 deletions .kokoro/presubmit/samples.cfg
Expand Up @@ -24,14 +24,10 @@ env_vars: {

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
value: "secret_manager/java-docs-samples-service-account"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "java_it_service_account"
}
}
}
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-docs-samples-service-account"
}
10 changes: 10 additions & 0 deletions .kokoro/release/publish_javadoc.cfg
@@ -1,14 +1,24 @@
# Format: //devtools/kokoro/config/proto/build.proto

gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/"

env_vars: {
key: "STAGING_BUCKET"
value: "docs-staging"
}

env_vars: {
key: "STAGING_BUCKET_V2"
value: "docs-staging-v2-staging"
# Production will be at: docs-staging-v2
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/java-common-protos/.kokoro/release/publish_javadoc.sh"
}


before_action {
fetch_keystore {
keystore_resource {
Expand Down
25 changes: 23 additions & 2 deletions .kokoro/release/publish_javadoc.sh
Expand Up @@ -24,20 +24,25 @@ if [[ -z "${STAGING_BUCKET}" ]]; then
exit 1
fi

if [[ -z "${STAGING_BUCKET_V2}" ]]; then
echo "Need to set STAGING_BUCKET_V2 environment variable"
exit 1
fi

# work from the git root directory
pushd $(dirname "$0")/../../

# install docuploader package
python3 -m pip install gcp-docuploader

# compile all packages
mvn clean install -B -DskipTests=true
mvn clean install -B -q -DskipTests=true

NAME=proto-google-common-protos
VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3)

# build the docs
mvn site -B
mvn site -B -q

pushd target/site/apidocs

Expand All @@ -53,3 +58,19 @@ python3 -m docuploader upload . \
--staging-bucket ${STAGING_BUCKET}

popd

# V2
mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/"

pushd target/devsite

# create metadata
python3 -m docuploader create-metadata \
--name ${NAME} \
--version ${VERSION} \
--language java

# upload docs
python3 -m docuploader upload . \
--credentials ${CREDENTIALS} \
--staging-bucket ${STAGING_BUCKET_V2}
31 changes: 3 additions & 28 deletions .kokoro/release/stage.cfg
Expand Up @@ -13,32 +13,7 @@ action {
}
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
}
}
}

# Fetch magictoken to use with Magic Github Proxy
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "releasetool-magictoken"
}
}
}

# Fetch api key to use with Magic Github Proxy
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "magic-github-proxy-api-key"
}
}
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
}
2 changes: 2 additions & 0 deletions .kokoro/trampoline.sh
Expand Up @@ -21,4 +21,6 @@ function cleanup() {
echo "cleanup";
}
trap cleanup EXIT

$(dirname $0)/populate-secrets.sh # Secret Manager secrets.
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -99,7 +99,16 @@ mvn -Penable-samples clean verify
```

2. [Activate](#profile-activation) the profile.
3. Define your samples in a normal Maven project in the `samples/` directory
3. Define your samples in a normal Maven project in the `samples/` directory.

### Code Formatting

Code in this repo is formatted with
[google-java-format](https://github.com/google/google-java-format).
To run formatting on your project, you can run:
```
mvn com.coveo:fmt-maven-plugin:format
```

### Profile Activation

Expand Down
3 changes: 2 additions & 1 deletion renovate.json
Expand Up @@ -76,5 +76,6 @@
"groupName": "jackson dependencies"
}
],
"semanticCommits": true
"semanticCommits": true,
"masterIssue": true
}

0 comments on commit 6b08cd9

Please sign in to comment.