Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .cloudbuild/samples_build.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
steps:
- name: gcr.io/cloud-devrel-public-resources/java8
- name: gcr.io/cloud-devrel-public-resources/java11
entrypoint: ls
args: [
'-alt',
]
- name: gcr.io/cloud-devrel-public-resources/java8
- name: gcr.io/cloud-devrel-public-resources/java11
entrypoint: curl
args: [
'--header',
'Metadata-Flavor: Google',
'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email'
]
- name: gcr.io/cloud-devrel-public-resources/java8
- name: gcr.io/cloud-devrel-public-resources/java11
entrypoint: pwd
- name: gcr.io/cloud-devrel-public-resources/java8
- name: gcr.io/cloud-devrel-public-resources/java11
entrypoint: bash
args: [
'.kokoro/build.sh'
Expand All @@ -22,7 +22,7 @@ steps:
- 'JOB_TYPE=samples'
- 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-sample'
- 'KOKORO_GITHUB_PULL_REQUEST_NUMBER=$_PR_NUMBER'
- name: gcr.io/cloud-devrel-public-resources/java8
- name: gcr.io/cloud-devrel-public-resources/java11
entrypoint: echo
args: [
'Sample job succeeded',
Expand Down
9 changes: 5 additions & 4 deletions .github/.OwlBot.yaml → .github/.OwlBot-hermetic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

docker:
image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest"
deep-remove-regex:
- "/proto-google-.*/src"

Expand All @@ -25,8 +22,12 @@ deep-copy-regex:
dest: "/owl-bot-staging/$1/proto-google-cloud-datastore-$1/src"
- source: "/google/datastore/admin/(v.*)/.*-java/proto-google-.*/src"
dest: "/owl-bot-staging/$1/proto-google-cloud-datastore-admin-$1/src"
- source: "/google/datastore/(v.*)/.*-java/grpc-google-.*/src"
dest: "/owl-bot-staging/$1/grpc-google-cloud-datastore-$1/src"
- source: "/google/datastore/admin/(v.*)/.*-java/grpc-google-.*/src"
dest: "/owl-bot-staging/$1/grpc-google-cloud-datastore-admin-$1/src"
# Admin & Data APIs share the same wrapper library.
- source: "/google/datastore/(v.*)/.*-java/gapic-google-.*/src"
dest: "/owl-bot-staging/$1/google-cloud-datastore/src"
- source: "/google/datastore/admin/(v.*)/.*-java/gapic-google-.*/src"
dest: "/owl-bot-staging/$1/google-cloud-datastore/src"
dest: "/owl-bot-staging/$1/google-cloud-datastore/src"
17 changes: 0 additions & 17 deletions .github/.OwlBot.lock.yaml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ updates:
# it via template in the synthtool repository.
ignore:
- dependency-name: "*"

# rules for the `V3-experimental` branch
- dependency-name: "*"

# rules for the `grpc-experimental` branch
- package-ecosystem: maven
directory: "/"
schedule:
Expand All @@ -28,4 +29,4 @@ updates:
# Prefix all commit messages with "deps: "
prefix: "deps"
open-pull-requests-limit: 10
target-branch: "V3-experimental"
target-branch: "grpc-experimental"
4 changes: 4 additions & 0 deletions .github/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ branches:
handleGHRelease: true
releaseType: java-backport
branch: 2.17.x
- bumpMinorPreMajor: true
handleGHRelease: true
releaseType: java-backport
branch: 2.19.x
168 changes: 168 additions & 0 deletions .github/scripts/update_generation_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#!/bin/bash
set -e
# This script should be run at the root of the repository.
# This script is used to update googleapis_commitish, gapic_generator_version,
# and libraries_bom_version in generation configuration at the time of running
# and create a pull request.

# The following commands need to be installed before running the script:
# 1. git
# 2. gh
# 3. jq

# Utility functions
# Get the latest released version of a Maven artifact.
function get_latest_released_version() {
local group_id=$1
local artifact_id=$2
latest=$(curl -s "https://search.maven.org/solrsearch/select?q=g:${group_id}+AND+a:${artifact_id}&core=gav&rows=500&wt=json" | jq -r '.response.docs[] | select(.v | test("^[0-9]+(\\.[0-9]+)*$")) | .v' | sort -V | tail -n 1)
echo "${latest}"
}

# Update a key to a new value in the generation config.
function update_config() {
local key_word=$1
local new_value=$2
local file=$3
echo "Update ${key_word} to ${new_value} in ${file}"
sed -i -e "s/^${key_word}.*$/${key_word}: ${new_value}/" "${file}"
}

# Update an action to a new version in GitHub action.
function update_action() {
local key_word=$1
local new_value=$2
local file=$3
echo "Update ${key_word} to ${new_value} in ${file}"
# use a different delimiter because the key_word contains "/".
sed -i -e "s|${key_word}@v.*$|${key_word}@v${new_value}|" "${file}"
}

# The parameters of this script is:
# 1. base_branch, the base branch of the result pull request.
# 2. repo, organization/repo-name, e.g., googleapis/google-cloud-java
# 3. [optional] generation_config, the path to the generation configuration,
# the default value is generation_config.yaml in the repository root.
# 4. [optional] workflow, the library generation workflow file,
# the default value is .github/workflows/hermetic_library_generation.yaml.
while [[ $# -gt 0 ]]; do
key="$1"
case "${key}" in
--base_branch)
base_branch="$2"
shift
;;
--repo)
repo="$2"
shift
;;
--generation_config)
generation_config="$2"
shift
;;
--workflow)
workflow="$2"
shift
;;
*)
echo "Invalid option: [$1]"
exit 1
;;
esac
shift
done

if [ -z "${base_branch}" ]; then
echo "missing required argument --base_branch"
exit 1
fi

if [ -z "${repo}" ]; then
echo "missing required argument --repo"
exit 1
fi

if [ -z "${generation_config}" ]; then
generation_config="generation_config.yaml"
echo "Use default generation config: ${generation_config}"
fi

if [ -z "${workflow}" ]; then
workflow=".github/workflows/hermetic_library_generation.yaml"
echo "Use default library generation workflow file: ${workflow}"
fi

current_branch="generate-libraries-${base_branch}"
title="chore: Update generation configuration at $(date)"

git checkout "${base_branch}"
# Try to find a open pull request associated with the branch
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")
# Create a branch if there's no open pull request associated with the
# branch; otherwise checkout the pull request.
if [ -z "${pr_num}" ]; then
git checkout -b "${current_branch}"
# Push the current branch to remote so that we can
# compare the commits later.
git push -u origin "${current_branch}"
else
gh pr checkout "${pr_num}"
fi

# Only allow fast-forward merging; exit with non-zero result if there's merging
# conflict.
git merge -m "chore: merge ${base_branch} into ${current_branch}" "${base_branch}"

mkdir tmp-googleapis
# Use partial clone because only commit history is needed.
git clone --filter=blob:none https://github.com/googleapis/googleapis.git tmp-googleapis
pushd tmp-googleapis
git pull
latest_commit=$(git rev-parse HEAD)
popd
rm -rf tmp-googleapis
update_config "googleapis_commitish" "${latest_commit}" "${generation_config}"

# Update gapic-generator-java version to the latest
latest_version=$(get_latest_released_version "com.google.api" "gapic-generator-java")
update_config "gapic_generator_version" "${latest_version}" "${generation_config}"

# Update composite action version to latest gapic-generator-java version
update_action "googleapis/sdk-platform-java/.github/scripts" \
"${latest_version}" \
"${workflow}"

# Update libraries-bom version to the latest
latest_version=$(get_latest_released_version "com.google.cloud" "libraries-bom")
update_config "libraries_bom_version" "${latest_version}" "${generation_config}"

git add "${generation_config}" "${workflow}"
changed_files=$(git diff --cached --name-only)
if [[ "${changed_files}" == "" ]]; then
echo "The latest generation config is not changed."
echo "Skip committing to the pull request."
else
git commit -m "${title}"
fi

# There are potentially at most two commits: merge commit and change commit.
# We want to exit the script if no commit happens (otherwise this will be an
# infinite loop).
# `git cherry` is a way to find whether the local branch has commits that are
# not in the remote branch.
# If we find any such commit, push them to remote branch.
unpushed_commit=$(git cherry -v "origin/${current_branch}" | wc -l)
if [[ "${unpushed_commit}" -eq 0 ]]; then
echo "No unpushed commits, exit"
exit 0
fi

if [ -z "${pr_num}" ]; then
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
git fetch -q remote_repo
git push -f remote_repo "${current_branch}"
gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}"
else
git push
gh pr edit "${pr_num}" --title "${title}" --body "${title}"
fi
34 changes: 22 additions & 12 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- javadoc
- library_generation
- unmanaged_dependency_check
- pattern: 1.106.5-sp
isAdminEnforced: true
requiredApprovingReviewCount: 1
Expand Down Expand Up @@ -62,7 +63,6 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- pattern: 2.2.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
Expand All @@ -77,7 +77,6 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- pattern: 2.12.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
Expand All @@ -92,7 +91,6 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- pattern: multi-db
Expand All @@ -109,10 +107,25 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- pattern: V3-experimental
- pattern: grpc-experimental
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: false
requiredStatusCheckContexts:
- dependencies (17)
- lint
- clirr
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- javadoc
- pattern: 2.15.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
Expand All @@ -125,11 +138,9 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- javadoc
- pattern: 2.15.x
- pattern: 2.17.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
Expand All @@ -142,10 +153,10 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- pattern: 2.17.x
- javadoc
- pattern: 2.19.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
Expand All @@ -158,7 +169,6 @@ branchProtectionRules:
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- javadoc
Expand Down
6 changes: 6 additions & 0 deletions .github/trusted-contribution.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
trustedContributors:
- renovate-bot
- gcf-owl-bot[bot]

annotations:
- type: comment
text: "/gcbrun"
- type: label
text: "kokoro:force-run"
2 changes: 1 addition & 1 deletion .github/workflows/approve-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme'
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: |
Expand Down
Loading
Loading