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: add presubmit check for generated types for direct resources #3396

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jingyih
Copy link
Collaborator

@jingyih jingyih commented Dec 16, 2024

Follow up of #3375.

This PR adds a presubmit check to prevent unintended manual edits to the generated types for direct resources. This will ensure that the tools can be safely rerun.

To opt-in the check, create a configuration YAML file and place it in the dev/tools/controllerbuilder/config directory. Here’s an example configuration file:

service: google.cloud.bigquery.datatransfer.v1
apiVersion: bigquerydatatransfer.cnrm.cloud.google.com/v1beta1
generateMapper: true
resources:
  - kind: BigQueryDataTransferConfig
    protoName: TransferConfig
    skipScaffoldFiles: true # files were scaffolded using a previous template, making them incompatible with the new scaffolding template.

Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cheftako for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jingyih jingyih changed the title Presubmit check generated types chore: add presubmit check for generated types for direct resources Dec 16, 2024
@jingyih jingyih force-pushed the presubmit_check_generated_types branch 2 times, most recently from e266d71 to 2ff4ee1 Compare December 17, 2024 01:00
@jingyih
Copy link
Collaborator Author

jingyih commented Dec 17, 2024

/cc @yuwenma @justinsb

Let me know your thoughts. I prefer that we add this check to ensure the tools can be safely rerun on the generated code. In the future, this could become an exit criteria for a direct beta resource.

Example error when running on Github ubuntu-22.04:
google/bigtable/admin/v2/instance.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.
@jingyih jingyih force-pushed the presubmit_check_generated_types branch from 2ff4ee1 to 8eb435a Compare December 20, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant