Skip to content

Validate Cloud Function deploy body after template rendering - #70531

Open
mitre88 wants to merge 1 commit into
apache:mainfrom
mitre88:fix-cloud-function-deploy
Open

Validate Cloud Function deploy body after template rendering#70531
mitre88 wants to merge 1 commit into
apache:mainfrom
mitre88:fix-cloud-function-deploy

Conversation

@mitre88

@mitre88 mitre88 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Part of the template-field validation burn-down tracked in #70296.

CloudFunctionDeployFunctionOperator lists body, location, and api_version in template_fields, but __init__ validated the body, ran ZipPathPreprocessor.preprocess_body() (which both validates and mutates the body), and constructed GcpBodyFieldValidator pinned to the un-rendered api_version. A fully templated body crashed with AttributeError at parse time inside the preprocessor. All of this now runs at the start of execute() against the rendered values.

The missing-location/body truthiness checks and the zip-path exclusivity rules depend on rendered values (an expression rendering to an empty string must count as missing), so per the discussion in #70505 these are genuine value reads, not provision checks.

Tests: converted the four construction-time raise tests to execute-time, and added test_templated_body_deploys_after_rendering, which constructs the operator with a templated body (previously a parse-time crash) and deploys once the field holds the rendered value — it fails against the previous implementation. The class is removed from the exemption list and the validate-operators-init check passes locally.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Fable 5)

Generated-by: Claude Code (Fable 5) following the guidelines

The operator's body, location, and api_version are template fields, but
the operator validated the body, preprocessed the zip path, and built
the field validator in __init__. A fully templated body crashed at
parse time inside ZipPathPreprocessor, and the validator was pinned to
the un-rendered api_version. All of it now happens at the start of
execute(), against rendered values. Part of the burn-down tracked in
apache#70296.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:providers backport-to-v3-3-test Backport to v3-3-test provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant