pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.34k stars 638 forks source link

Make sure FirstPartyHelmDeploymentMapping doesn't get calculated if disabled (Cherry-pick of #21633) #21635

Closed WorkerPants closed 1 week ago

WorkerPants commented 1 week ago

Option [helm-infer].deployment_dependencies was added in https://github.com/pantsbuild/pants/pull/21282. Unfortunately, I missed one place where FirstPartyHelmDeploymentMapping is requested:

@rule(desc="Prepare Helm deployment post-renderer", level=LogLevel.DEBUG)
async def prepare_post_renderer_for_helm_deployment(
    request: HelmDeploymentPostRendererRequest,
    union_membership: UnionMembership,
    docker_options: DockerOptions,
) -> SetupHelmPostRenderer:
    mapping = await Get(
        FirstPartyHelmDeploymentMapping, FirstPartyHelmDeploymentMappingRequest(request.field_set)
    )
    ...

Here I move this logic inside the rule, so that all consumers correctly handle the case when [helm-infer].deployment_dependencies is set to false