Skip to content

Conversation

@diegomarquezp
Copy link
Contributor

@diegomarquezp diegomarquezp commented May 28, 2024

This is part of the effort to enable multi-version support in hand-written libraries. More context and details in this doc.

This PR adds two workflows and their scripts:

  • update_generation_config which updates generation_config.yaml (added in this PR) to contain the latest googleapis_committish (source of truth of library generation) as well as other dependencies such as gapic_generator_version. This job runs nightly and creates a PR that modifies the config yaml.
  • hermetic_library_generation which reads generation_config.yaml and pushes a new commit to any PR whose latest commit affects generation_config.yaml (e.g. the nightly PR created by update_generation_config). It essentially translates changes in the config yaml to changes in the source code (of the generated part). This workflow will be a required check.

As an example of how they work in practice:

  1. Once per night, update_generation_config creates a PR that updates generation_config.yaml with the latest dependencies and googleapis committish
  2. hermetic_library_generation is triggered by this PR and generates the corresponding code changes. A new commit with the code changes is added to the PR. This step may occur for any PR affecting generation_config.yaml.

Follow ups

  • Add CLOUD_JAVA_BOT_TOKEN to repository for the hermetic generation workflow to work. We confirmed it works in a fork (job link).

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels May 28, 2024
@conventional-commit-lint-gcf
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@diegomarquezp diegomarquezp marked this pull request as ready for review June 20, 2024 21:09
@diegomarquezp diegomarquezp requested review from a team as code owners June 20, 2024 21:09
@diegomarquezp diegomarquezp requested a review from blakeli0 June 26, 2024 21:39
@BenWhitehead BenWhitehead changed the title feat: enable hermetic library generation build: enable hermetic library generation Jun 27, 2024
Comment on lines +1 to +3
gapic_generator_version: 2.42.0
googleapis_commitish: b2c018cb067ab01cb5db2170b73a82caef173ae4
libraries_bom_version: 26.38.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will libraries_bom_version and gapic_generator_version be updated by renovate bot, or the update_generation_config action?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will be updated by update_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 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}"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could that cause any issues if the version in the library or samples updates via renovate-bot first?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libraries_bom_version is only used to generate the version in README by the hermetic build scripts, it should not cause any conflicts with the libraries bom version in samples.

There is no gapic_generator_version in pom, I guess you mean sdk-patform-java-config, which includes gax changes? If yes, this is similar to what we have right now with owlbot PRs.
The owlbot PR changes from the generator update may require gax changes. Similarly, the Cloud Java Bot PR may require us to merge the sdk-patform-java-config update first. But there should not be any issues the other way around, we should be free to merge sdk-patform-java-config update anytime, without waiting on Cloud Java Bot PRs created from the gapic_generator_version update.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying

runs-on: ubuntu-22.04
env:
# the branch into which the pull request is merged
base_branch: main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we make branches for lts releases will this need to be manually changed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on the type of LTS.

  • If it is an LTS that does not need regular updates to googleapis_commitish or generator version, basically the LTS branches we current have. Then we would not set up any automation for it, and only change the generator version when there is a critical bug fix.
  • If it is an LTS that requires regular updates, for example, if we want to introduce a Java 21 branch, then yes we will need to update this config on the Java 21 branch.

Copy link
Collaborator

@BenWhitehead BenWhitehead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with the changes as outlined here. How do we get the status check to actually turn green?

@diegomarquezp
Copy link
Contributor Author

I'm okay with the changes as outlined here. How do we get the status check to actually turn green?

@BenWhitehead We confirmed it works in a diegomarquezp#10 (diegomarquezp#10).

It requires CLOUD_JAVA_BOT_TOKEN to be added, which is a follow up item.

@diegomarquezp diegomarquezp added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 28, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 28, 2024
@diegomarquezp diegomarquezp added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 30, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 30, 2024
@diegomarquezp diegomarquezp merged commit 99e2bf1 into googleapis:main Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants