Skip to content

chore(hermetic-build): include .github template updates as part of generation #3723

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

Merged
merged 14 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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: 18 additions & 4 deletions hermetic_build/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ owl-bot copy-code --version
The key step is `npm link`, which will make the command available in you current
shell session.

If you get a permission denied error when running the command `owl-bot`, try
relinking owl-bot by running `npm unlink -g` and re-running the steps above.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why would rerun the same command can solve the permission issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

npm link has effect in the current shell session. My guess is that what's in an old session may get its permissions overriden.


## Run the script
The entrypoint script (`hermetic_build/library_generation/cli/entry_point.py`)
allows you to generate a GAPIC repository with a given api definition (proto,
Expand All @@ -153,12 +156,14 @@ export path_to_repo="$(pwd)/google-cloud-java"
### Install the scripts

You can skip this step if you've installed the packages in [Install package dependencies](#install-package-dependencies).
Use the `--editable` flag for your changes to take effect as soon as you modify any file inside
the package.

```shell
python -m pip install --require-hashes -r hermetic_build/common/requirements.txt
python -m pip install hermetic_build/common
python -m pip install --editable hermetic_build/common
python -m pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
python -m pip install hermetic_build/library_generation
python -m pip install --editable hermetic_build/library_generation
```

### Run the script
Expand Down Expand Up @@ -212,10 +217,19 @@ python hermetic_build/library_generation/cli/entry_point.py generate \
--api-definitions-path=/workspace/apis
```

# Debug the library generation container
# Debugging tips
## Debug the scripts
Especially on local setups, consider adding the `xtrace` (`set -x`) flag to
- `hermetic_build/library_generation/generate_library.sh`
- `hermetic_build/library_generation/utils/utilities.sh`

This will allow you to observe how the tools you prepared in `~/.library_generation` are being used.


## Debug the library generation container
If you are working on changing the way the containers are created, you may want
to inspect the containers to check the setup.
It would be convenient in such case to have a text editor/viewer available.
It would be convenient in such case to have a text editor/viewer available.
You can achieve this by modifying the Dockerfile as follows:

```dockerfile
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
externalManifests:
- type: json
file: 'synth.metadata'
jsonpath: '$.generatedFiles[*]'
- type: json
file: '.github/readme/synth.metadata/synth.metadata'
jsonpath: '$.generatedFiles[*]'
ignoreAuthors:
- 'renovate-bot'
- 'yoshi-automation'
- 'release-please[bot]'
- 'gcf-owl-bot[bot]'
4 changes: 4 additions & 0 deletions hermetic_build/library_generation/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"owlbot/src/poms/*.py",
"owlbot/templates/clirr/*.j2",
"owlbot/templates/poms/*.j2",
"owlbot/templates/java_library/.github/**/*",
# TODO: uncomment this line after https://github.com/googleapis/sdk-platform-java/pull/3723
# has been merged.
#"owlbot/templates/java_library/.kokoro/**/*",
"owlbot/templates/java_library/**/*",
Copy link
Collaborator

@JoeWang1127 JoeWang1127 Mar 27, 2025

Choose a reason for hiding this comment

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

Do we still need this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, there are files outside .github and .kokoro that this line would include.

],
"synthtool": ["owlbot/synthtool/**/*"],
Expand Down
Loading