• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 18517631058

15 Oct 2025 04:18AM UTC coverage: 69.207% (-11.1%) from 80.267%
18517631058

Pull #22745

github

web-flow
Merge 642a76ca1 into 99919310e
Pull Request #22745: [windows] Add windows support in the stdio crate.

53815 of 77759 relevant lines covered (69.21%)

2.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/python/pants/backend/helm/goals/deploy.py
1
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
×
5

6
import logging
×
7
from dataclasses import dataclass
×
8

9
from pants.backend.docker.goals.package_image import DockerPackageFieldSet
×
10
from pants.backend.helm.dependency_inference import deployment
×
11
from pants.backend.helm.subsystems.helm import HelmSubsystem
×
12
from pants.backend.helm.subsystems.post_renderer import setup_post_renderer_launcher
×
13
from pants.backend.helm.target_types import (
×
14
    HelmDeploymentFieldSet,
15
    HelmDeploymentTarget,
16
    HelmDeploymentTimeoutField,
17
)
18
from pants.backend.helm.util_rules import post_renderer
×
19
from pants.backend.helm.util_rules.post_renderer import HelmDeploymentPostRendererRequest
×
20
from pants.backend.helm.util_rules.renderer import (
×
21
    HelmDeploymentCmd,
22
    HelmDeploymentRequest,
23
    materialize_deployment_process_wrapper_into_interactive_process,
24
)
25
from pants.core.goals.deploy import DeployFieldSet, DeployProcess, DeploySubsystem
×
26
from pants.engine.internals.graph import resolve_targets
×
27
from pants.engine.rules import collect_rules, concurrently, implicitly, rule
×
28
from pants.engine.target import DependenciesRequest
×
29
from pants.engine.unions import UnionRule
×
30
from pants.util.docutil import bin_name
×
31
from pants.util.logging import LogLevel
×
32
from pants.util.strutil import softwrap
×
33

34
logger = logging.getLogger(__name__)
×
35

36

37
@dataclass(frozen=True)
×
38
class DeployHelmDeploymentFieldSet(HelmDeploymentFieldSet, DeployFieldSet):
×
39
    timeout: HelmDeploymentTimeoutField
×
40

41

42
@rule(desc="Run Helm deploy process", level=LogLevel.DEBUG)
×
43
async def run_helm_deploy(
×
44
    field_set: DeployHelmDeploymentFieldSet,
45
    helm_subsystem: HelmSubsystem,
46
    deploy_subsystem: DeploySubsystem,
47
) -> DeployProcess:
48
    dry_run_args = ["--dry-run"] if deploy_subsystem.dry_run else []
×
49
    passthrough_args = helm_subsystem.valid_args(
×
50
        extra_help=softwrap(
51
            f"""
52
            Most invalid arguments have equivalent fields in the `{HelmDeploymentTarget.alias}` target.
53
            Usage of fields is encouraged over passthrough arguments as that enables repeatable deployments.
54

55
            Please run `{bin_name()} help {HelmDeploymentTarget.alias}` for more information.
56

57
            To use `--dry-run`, run `{bin_name()} experimental-deploy --dry-run ::`.
58
            """
59
        )
60
    )
61

62
    target_dependencies, post_renderer = await concurrently(
×
63
        resolve_targets(**implicitly(DependenciesRequest(field_set.dependencies))),
64
        setup_post_renderer_launcher(**implicitly(HelmDeploymentPostRendererRequest(field_set))),
65
    )
66

67
    publish_targets = [
×
68
        tgt for tgt in target_dependencies if DockerPackageFieldSet.is_applicable(tgt)
69
    ]
70

71
    interactive_process = await materialize_deployment_process_wrapper_into_interactive_process(
×
72
        **implicitly(
73
            HelmDeploymentRequest(
74
                cmd=HelmDeploymentCmd.UPGRADE,
75
                field_set=field_set,
76
                extra_argv=[
77
                    "--install",
78
                    *(
79
                        ("--timeout", f"{field_set.timeout.value}s")
80
                        if field_set.timeout.value
81
                        else ()
82
                    ),
83
                    *passthrough_args,
84
                    *dry_run_args,
85
                ],
86
                post_renderer=post_renderer,
87
                description=f"Running Helm deployment: {field_set.address}",
88
            )
89
        )
90
    )
91

92
    return DeployProcess(
×
93
        name=field_set.address.spec,
94
        publish_dependencies=tuple(publish_targets),
95
        process=interactive_process,
96
    )
97

98

99
def rules():
×
100
    return [
×
101
        *collect_rules(),
102
        *deployment.rules(),
103
        *post_renderer.rules(),
104
        UnionRule(DeployFieldSet, DeployHelmDeploymentFieldSet),
105
    ]
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc