Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update generation configuration at Thu Dec 12 22:50:27 UTC 2024 #1727

Merged
merged 24 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
eea9fb2
chore: Update generation configuration at Mon Nov 18 02:27:18 UTC 2024
cloud-java-bot Nov 18, 2024
633dd81
chore: Update generation configuration at Tue Nov 19 02:26:24 UTC 2024
cloud-java-bot Nov 19, 2024
b2f308b
chore: Update generation configuration at Wed Nov 20 02:25:57 UTC 2024
cloud-java-bot Nov 20, 2024
c72fc48
chore: Update generation configuration at Thu Nov 21 02:25:47 UTC 2024
cloud-java-bot Nov 21, 2024
d059870
chore: Update generation configuration at Fri Nov 22 02:26:26 UTC 2024
cloud-java-bot Nov 22, 2024
3edbd8d
chore: Update generation configuration at Sat Nov 23 02:25:13 UTC 2024
cloud-java-bot Nov 23, 2024
ee29506
chore: Update generation configuration at Tue Nov 26 02:26:45 UTC 2024
cloud-java-bot Nov 26, 2024
115e574
chore: Update generation configuration at Wed Nov 27 02:27:32 UTC 2024
cloud-java-bot Nov 27, 2024
a115cfe
chore: Update generation configuration at Thu Nov 28 02:27:16 UTC 2024
cloud-java-bot Nov 28, 2024
532be41
chore: Update generation configuration at Fri Nov 29 02:27:18 UTC 2024
cloud-java-bot Nov 29, 2024
fd5de6d
chore: Update generation configuration at Tue Dec 3 02:27:57 UTC 2024
cloud-java-bot Dec 3, 2024
b5a8003
chore: Update generation configuration at Wed Dec 4 02:28:06 UTC 2024
cloud-java-bot Dec 4, 2024
03dc939
chore: Update generation configuration at Thu Dec 5 02:28:17 UTC 2024
cloud-java-bot Dec 5, 2024
3552dda
chore: Update generation configuration at Fri Dec 6 02:27:41 UTC 2024
cloud-java-bot Dec 6, 2024
0e8aad8
chore: generate libraries at Fri Dec 6 02:28:14 UTC 2024
cloud-java-bot Dec 6, 2024
bf465f7
chore: Update generation configuration at Sat Dec 7 02:27:13 UTC 2024
cloud-java-bot Dec 7, 2024
ffae479
chore: Update generation configuration at Tue Dec 10 02:28:40 UTC 2024
cloud-java-bot Dec 10, 2024
393aa2e
chore: Update generation configuration at Wed Dec 11 02:27:53 UTC 2024
cloud-java-bot Dec 11, 2024
c6e04dc
chore: Update generation configuration at Thu Dec 12 02:27:47 UTC 2024
cloud-java-bot Dec 12, 2024
0eda3c1
chore: Update generation configuration at Thu Dec 12 22:50:27 UTC 2024
cloud-java-bot Dec 12, 2024
84f2de6
update workflow script
JoeWang1127 Dec 12, 2024
d7ecb69
update generation config
JoeWang1127 Dec 12, 2024
5058329
Merge branch 'main' into generate-libraries-main
JoeWang1127 Dec 12, 2024
dfba37c
chore: generate libraries at Thu Dec 12 22:54:42 UTC 2024
cloud-java-bot Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 55 additions & 8 deletions .github/scripts/update_generation_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,23 @@ function update_config() {
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
Expand All @@ -48,6 +60,10 @@ case "${key}" in
generation_config="$2"
shift
;;
--workflow)
workflow="$2"
shift
;;
*)
echo "Invalid option: [$1]"
exit 1
Expand All @@ -71,21 +87,34 @@ if [ -z "${generation_config}" ]; then
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)"

# try to find a open pull request associated with the branch
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
# 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.
# 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
Expand All @@ -94,25 +123,43 @@ popd
rm -rf tmp-googleapis
update_config "googleapis_commitish" "${latest_commit}" "${generation_config}"

# update gapic-generator-java version to the latest
# 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 libraries-bom version to the latest
# 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}"
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
git commit -m "${title}"

if [ -z "${pr_num}" ]; then
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
git fetch -q --unshallow remote_repo
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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.43.0</version>
<version>26.51.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -51,7 +51,7 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.50.0')
implementation platform('com.google.cloud:libraries-bom:26.51.0')

implementation 'com.google.cloud:google-cloud-logging'
```
Expand Down
6 changes: 3 additions & 3 deletions generation_config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gapic_generator_version: 2.50.0
googleapis_commitish: 9077c0ed8bda4a52290bdde16a6df91944e59c0f
libraries_bom_version: 26.50.0
gapic_generator_version: 2.51.0
googleapis_commitish: 7d0c6bee2517d77635beb2a1dd6d6e7d4d943512
libraries_bom_version: 26.51.0
libraries:
- api_shortname: logging
name_pretty: Cloud Logging
Expand Down
17 changes: 0 additions & 17 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@
],
"depNameTemplate": "com.google.cloud:sdk-platform-java-config",
"datasourceTemplate": "maven"
},
{
"fileMatch": [
"^.github/workflows/hermetic_library_generation.yaml$"
],
"matchStrings": [
"uses: googleapis/sdk-platform-java/.github/scripts@v(?<currentValue>.+?)\\n"
],
"depNameTemplate": "com.google.api:gapic-generator-java",
"datasourceTemplate": "maven"
}
],
"packageRules": [
Expand Down Expand Up @@ -111,13 +101,6 @@
"^com.fasterxml.jackson.core"
],
"groupName": "jackson dependencies"
},
{
"matchPackagePatterns": [
"^com.google.api:gapic-generator-java",
"^com.google.cloud:sdk-platform-java-config"
],
"groupName": "SDK platform Java dependencies"
}
],
"semanticCommits": true,
Expand Down
Loading