postprocessor
commandmoduleThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
postprocessor
Running OwlBot locally
Follow instructions inOwlBot Usage Guide - "How will I test my .github/.OwlBot.yaml file" using the instructions forsplit repositories.Note, if you replace step 2 with a clone of your own fork of thegoogleapis/googleapis-gen.git repo, you can see how changes in your forkedgoogleapis-gen repo are eventually propagated through to the library withoutmaking changes to the protos. Lack of permissions may also force you to clone afork instead of the repo.
After following these steps the generated code will have replaced correspondingfiles in thegoogle-cloud-go repo.
Running the post-processor docker container locally
You can verify the name of the docker container name can be found in the.github/OwlBot.yaml andgithub/OwlBot.lock.yaml files.
In thegoogle-cloud-go root directory:
docker pull gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latestdocker run --user $(id -u):$(id -g) --rm -v $(pwd):/repo -w /repo gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latestMaking changes, rebuilding the docker container and updating the OwlBot SHA
After making changes to the post-processor, you need to publish a new versionof the post-processor docker container and manually update the which version ofthe post-processor is used by OwlBot. To do this you need to update the SHA inthe OwlBot lock file.
In your
google-cloud-gorepo, create a branch.Make changes to the post-processor.
Test your changes. You can run the post-processor locally on selectedclients or on all of the clients in the root directory. If the
branchflag is empty/unset, the post-processor will exit early without changes.In thegoogle-cloud-go/internal/postprocessordirectory:go run . -client-root="../.." -googleapis-dir="/path/to/local/googleapis" -branch="my-branch"To test only selected clients:
go run . -client-root="../.." -googleapis-dir="/path/to/local/googleapis" -branch="my-branch" -dirs="accessapproval,asset"Clean up any changes made by post-processor test runs in the previous step.
Commit your changes.
Open your PR and respond to feedback.
After your PR is approved and CI is green, merge your changes. An automatedjob should update the SHA of the post-processor docker image in
google-cloud-go/.github/.OwlBot.lock.yaml.
Updating the postprocessor version used by OwlBot
After making changes to this package land inmain, a new Docker image will bebuilt and pushed automatically. To update the image version used by OwlBot, runthe following command (you will need Docker installed and running):
docker pull gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latestExtract thesha256 Digest from the logs emitted by thepull and set it asthe digest in thelockfile.
Send a pull request with the updated.github/.OwlBot.lock.yaml.
Note: Any open OwlBot PR will need to be caught-up and the postprocessor rerunto capture the changes.
Initializing new modules
The post-processor initializes new modules by generating the required filesinternal/version.go,go.mod,README.md andCHANGES.md.
To add a new module, add the directory name of the module tomodules ingoogle-cloud-go/internal/postprocessor/config.yaml. Please maintainalphabetical ordering of the module names.
Updating the Repo Metadata Manifest
Themanifest command regenerates theinternal/.repo-metadata-full.json file.This file contains metadata about all of the modules in the repository.
There are two modes of operation:
- Full Regeneration (default): This mode regenerates the entire file from scratch based on the existing
config.yamland.OwlBot.yamlfiles. It should be run anytime there are changes to those configuration files. To prevent accidental data loss, this mode automatically preserves existing entries for modules listed in theskip-module-scan-pathssection of the configuration. - Targeted Update (
-modulesflag): This mode allows you to add or refresh one or more specific modules without regenerating the entire file. This is useful for adding a newly-generated module to the manifest.
To run a full regeneration, from therepository root, run the following:
go run ./internal/postprocessor manifest -googleapis-dir=$GOOGLEAPISTo add or refresh only theaccessapproval andasset modules:
go run ./internal/postprocessor manifest -googleapis-dir=$GOOGLEAPIS -modules=accessapproval,assetNote:$GOOGLEAPIS should be an absolute path to a local clone ofgoogleapis/googleapis.
Validating your config changes
Thevalidate command is run as a presubmit on changes to either the.github/.OwlBot.yaml or theinternal/postprocessor/config.yaml.
If you want to run it manually, from therepository root, simply run thefollowing:
go run ./internal/postprocessor validateIf you want to validate existence of service config yaml in the PostProcessorconfig, provide an absolute path to a local clone ofgoogleapis:
go run ./internal/postprocessor validate -googleapis-dir=$GOOGLEAPISIf you want validate a specific config file, not the repository default, thenprovide aboslute paths to either or both config files like so:
go run ./internal/postprocessor \ -owl-bot-config=$OWL_BOT_YAML \ -processor-config=$CONFIG_YAMLIf you think there is an issue with the validator, just fix it in the same CLas the config change that triggered it. No need to update the postprocessor shawhen the validate command is changed, it runs from HEAD of the branch.
Documentation¶
There is no documentation for this package.