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

pantsbuild / pants / 18198316586

02 Oct 2025 03:50PM UTC coverage: 78.82% (-1.4%) from 80.265%
18198316586

push

github

web-flow
Bump serde from 1.0.226 to 1.0.228 in /src/rust (#22723)

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.226 to
1.0.228.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/serde-rs/serde/releases">serde's
releases</a>.</em></p>
<blockquote>
<h2>v1.0.228</h2>
<ul>
<li>Allow building documentation with
<code>RUSTDOCFLAGS='--cfg=docsrs'</code> set for the whole dependency
graph (<a
href="https://redirect.github.com/serde-rs/serde/issues/2995">#2995</a>)</li>
</ul>
<h2>v1.0.227</h2>
<ul>
<li>Documentation improvements (<a
href="https://redirect.github.com/serde-rs/serde/issues/2991">#2991</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/serde-rs/serde/commit/a866b336f"><code>a866b33</code></a>
Release 1.0.228</li>
<li><a
href="https://github.com/serde-rs/serde/commit/5adc9e816"><code>5adc9e8</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/serde/issues/2995">#2995</a>
from dtolnay/rustdocflags</li>
<li><a
href="https://github.com/serde-rs/serde/commit/ab581789f"><code>ab58178</code></a>
Workaround for RUSTDOCFLAGS='--cfg=docsrs'</li>
<li><a
href="https://github.com/serde-rs/serde/commit/415d9fc56"><code>415d9fc</code></a>
Release 1.0.227</li>
<li><a
href="https://github.com/serde-rs/serde/commit/7c58427e1"><code>7c58427</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/serde/issues/2991">#2991</a>
from dtolnay/inlinecoredoc</li>
<li><a
href="https://github.com/serde-rs/serde/commit/9d3410e3f"><code>9d3410e</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/serde/issues/2992">#2992</a>
from dtolnay/inplaceseed</li>
<li><a
href="https://github.com/serde-rs/serde/commit/2fb6748bf1ff93... (continued)

73576 of 93347 relevant lines covered (78.82%)

2.9 hits per line

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

67.16
/src/python/pants/backend/helm/resolve/fetch.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
7✔
5

6
import logging
7✔
7
import os
7✔
8
from dataclasses import dataclass
7✔
9
from typing import Any
7✔
10

11
from pants.backend.helm.resolve import artifacts
7✔
12
from pants.backend.helm.resolve.artifacts import (
7✔
13
    HelmArtifact,
14
    ResolvedHelmArtifact,
15
    resolved_helm_artifact,
16
)
17
from pants.backend.helm.target_types import HelmArtifactFieldSet, HelmArtifactTarget
7✔
18
from pants.backend.helm.util_rules import tool
7✔
19
from pants.backend.helm.util_rules.tool import HelmProcess
7✔
20
from pants.engine.addresses import Address
7✔
21
from pants.engine.engine_aware import EngineAwareParameter, EngineAwareReturnType
7✔
22
from pants.engine.fs import (
7✔
23
    CreateDigest,
24
    DigestSubset,
25
    Directory,
26
    FileDigest,
27
    PathGlobs,
28
    RemovePrefix,
29
    Snapshot,
30
)
31
from pants.engine.intrinsics import (
7✔
32
    create_digest,
33
    digest_subset_to_digest,
34
    digest_to_snapshot,
35
    remove_prefix,
36
)
37
from pants.engine.process import execute_process_or_raise
7✔
38
from pants.engine.rules import collect_rules, concurrently, implicitly, rule
7✔
39
from pants.engine.target import Target
7✔
40
from pants.util.logging import LogLevel
7✔
41
from pants.util.strutil import softwrap
7✔
42

43
logger = logging.getLogger(__name__)
7✔
44

45

46
class InvalidHelmArtifactTarget(Exception):
7✔
47
    def __init__(self, target: Target) -> None:
7✔
48
        super().__init__(
×
49
            softwrap(
50
                f"""
51
                Can not fetch a Helm artifact for a `{target.alias}` target.
52

53
                Helm artifacts are defined using target `{HelmArtifactTarget.alias}`.
54
                """
55
            )
56
        )
57

58

59
@dataclass(frozen=True)
7✔
60
class FetchHelmArtifactRequest(EngineAwareParameter):
7✔
61
    field_set: HelmArtifactFieldSet
7✔
62
    description_of_origin: str
7✔
63

64
    @classmethod
7✔
65
    def from_target(cls, target: Target, *, description_of_origin: str) -> FetchHelmArtifactRequest:
7✔
66
        if not HelmArtifactFieldSet.is_applicable(target):
×
67
            raise InvalidHelmArtifactTarget(target)
×
68

69
        return cls(
×
70
            field_set=HelmArtifactFieldSet.create(target),
71
            description_of_origin=description_of_origin,
72
        )
73

74
    def debug_hint(self) -> str | None:
7✔
75
        return f"{self.field_set.address} from {self.description_of_origin}"
×
76

77
    def metadata(self) -> dict[str, Any] | None:
7✔
78
        return {
×
79
            "address": self.field_set.address.spec,
80
            "description_of_origin": self.description_of_origin,
81
        }
82

83

84
@dataclass(frozen=True)
7✔
85
class FetchedHelmArtifact(EngineAwareReturnType):
7✔
86
    artifact: ResolvedHelmArtifact
7✔
87
    snapshot: Snapshot
7✔
88

89
    @property
7✔
90
    def address(self) -> Address:
7✔
91
        return self.artifact.address
×
92

93
    def level(self) -> LogLevel | None:
7✔
94
        return LogLevel.DEBUG
×
95

96
    def message(self) -> str | None:
7✔
97
        return softwrap(
×
98
            f"""
99
            Fetched Helm artifact '{self.artifact.name}' with version {self.artifact.version}
100
            using URL: {self.artifact.chart_url}
101
            """
102
        )
103

104
    def metadata(self) -> dict[str, Any] | None:
7✔
105
        return {"artifact": self.artifact}
×
106

107
    def artifacts(self) -> dict[str, FileDigest | Snapshot] | None:
7✔
108
        return {"snapshot": self.snapshot}
×
109

110

111
def assemble_pull_target(resolved_artifact: ResolvedHelmArtifact) -> list[str]:
7✔
112
    """The target of `pull` need different args depending on whether it's an OCI Registry or a Helm
113
    Chart Repository."""
114
    is_oci = resolved_artifact.requirement.location.spec.startswith("oci://")
×
115
    if is_oci:
×
116
        return [f"{resolved_artifact.location_url}/{resolved_artifact.name}"]
×
117
    else:
118
        return [resolved_artifact.name, "--repo", resolved_artifact.location_url]
×
119

120

121
@rule(desc="Fetch Helm artifact", level=LogLevel.DEBUG)
7✔
122
async def fetch_helm_artifact(request: FetchHelmArtifactRequest) -> FetchedHelmArtifact:
7✔
123
    download_prefix = "__downloads"
×
124

125
    empty_download_digest, resolved_artifact = await concurrently(
×
126
        create_digest(CreateDigest([Directory(download_prefix)])),
127
        resolved_helm_artifact(
128
            **implicitly({HelmArtifact.from_field_set(request.field_set): HelmArtifact})
129
        ),
130
    )
131

132
    download_result = await execute_process_or_raise(
×
133
        **implicitly(
134
            HelmProcess(
135
                argv=[
136
                    "pull",
137
                    *assemble_pull_target(resolved_artifact),
138
                    "--version",
139
                    resolved_artifact.version,
140
                    "--destination",
141
                    download_prefix,
142
                    "--untar",
143
                ],
144
                input_digest=empty_download_digest,
145
                description=f"Pulling Helm Chart '{resolved_artifact.name}' with version {resolved_artifact.version}.",
146
                output_directories=(download_prefix,),
147
                level=LogLevel.DEBUG,
148
            )
149
        )
150
    )
151

152
    raw_output_digest = await remove_prefix(
×
153
        RemovePrefix(download_result.output_digest, download_prefix)
154
    )
155

156
    # The download result will come with a tarball alongside the unzipped sources, pick the chart sources only.
157
    artifact_sources_digest = await digest_subset_to_digest(
×
158
        DigestSubset(raw_output_digest, PathGlobs([os.path.join(resolved_artifact.name, "**")]))
159
    )
160
    artifact_snapshot = await digest_to_snapshot(
×
161
        **implicitly(RemovePrefix(artifact_sources_digest, resolved_artifact.name))
162
    )
163

164
    return FetchedHelmArtifact(artifact=resolved_artifact, snapshot=artifact_snapshot)
×
165

166

167
def rules():
7✔
168
    return [*collect_rules(), *artifacts.rules(), *tool.rules()]
6✔
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