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: trigger generation on commits affecting any file #2117

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8f791bd
feat: enable hermetic library generation
diegomarquezp May 27, 2024
81bcd54
fix config yaml syntax
diegomarquezp May 27, 2024
462b3fc
do not map runners home folder
diegomarquezp May 28, 2024
79fe5dc
try dummy proto_path
diegomarquezp May 28, 2024
85ea80d
use copyright update comittish
diegomarquezp May 28, 2024
278b63f
correct proto_path
diegomarquezp May 28, 2024
62c0be2
update protoc
diegomarquezp May 28, 2024
cba00e6
preserve pr_description
diegomarquezp May 29, 2024
d9e9e3a
update gapic_generator_version to 2.41.0
diegomarquezp Jun 4, 2024
e17e355
infer image tag from config yaml
diegomarquezp Jun 12, 2024
a92d99f
correct workflow name
diegomarquezp Jun 12, 2024
3d766b8
update config scripts and yamls
diegomarquezp Jun 12, 2024
89e3d5d
remove old update_googleapis_committish workflow
diegomarquezp Jun 20, 2024
0de5054
sync config structure with that of google-cloud-java
diegomarquezp Jun 20, 2024
7b74b3e
remove quotes from config yamls
diegomarquezp Jun 25, 2024
53a1c5b
fix typo in update_generation_config.yaml
diegomarquezp Jun 25, 2024
1aefc6e
correct
diegomarquezp Jun 25, 2024
067b32c
quote codeowners_team in generation config
diegomarquezp Jun 26, 2024
d5a8f20
update generator version
diegomarquezp Jun 26, 2024
8b6d6e2
fix library info
diegomarquezp Jun 28, 2024
1507a6e
retrigger jobs
diegomarquezp Jun 28, 2024
713c6de
fix path to hermetic_library_generation
diegomarquezp Jul 2, 2024
2e43668
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 2, 2024
155fca1
fixes to hermetic_library_generation
diegomarquezp Jul 2, 2024
c3dd98b
Merge remote-tracking branch 'googleapis/main'
diegomarquezp Jul 18, 2024
75ca152
chore: trigger generation on PRs affecting any file
diegomarquezp Jul 18, 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
22 changes: 5 additions & 17 deletions .github/scripts/hermetic_library_generation.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#!/bin/bash
set -e
# This script should be run at the root of the repository.
# This script is used to, when a pull request changes the generation
# configuration (generation_config.yaml by default):
# 1. Find whether the last commit in this pull request contains changes to
# the generation configuration and exit early if it doesn't have such a change
# since the generation result would be the same.
# 2. Compare generation configurations in the current branch (with which the
# This script is used to, when a pull request changes any file in the repo:
# 1. Compare generation configurations in the current branch (with which the
# pull request associated) and target branch (into which the pull request is
# merged);
# 3. Generate changed libraries using library_generation image;
# 4. Commit the changes to the pull request, if any.
# 5. Edit the PR body with generated pull request description, if applicable.
# 2. Generate changed libraries using library_generation image;
# 3. Commit the changes to the pull request, if any.
# 4. Edit the PR body with generated pull request description, if applicable.

# The following commands need to be installed before running the script:
# 1. git
Expand Down Expand Up @@ -67,13 +63,6 @@ message="chore: generate libraries at $(date)"

git checkout "${target_branch}"
git checkout "${current_branch}"
# if the last commit doesn't contain changes to generation configuration,
# do not generate again as the result will be the same.
change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)"
if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then
echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true
exit 0
fi
# copy generation configuration from target branch to current branch.
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)
Expand All @@ -87,7 +76,6 @@ docker run \
-u "$(id -u):$(id -g)" \
-v "$(pwd):${workspace_name}" \
gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \
--baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \
--current-generation-config-path="${workspace_name}/${generation_config}"


Expand Down
4 changes: 2 additions & 2 deletions generation_config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gapic_generator_version: 2.42.0
googleapis_commitish: 19577edb4d439db98d2fb1f6f48f2e1b29fba099
libraries_bom_version: 26.43.0
googleapis_commitish: 6f289d775912966eb0cf04bda91e5e355c998d30
libraries_bom_version: 26.38.0
libraries:
- api_shortname: pubsub
name_pretty: Cloud Pub/Sub
Expand Down
Loading