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

pantsbuild / pants / 23505168284

24 Mar 2026 06:11PM UTC coverage: 92.618% (-0.3%) from 92.918%
23505168284

Pull #23133

github

web-flow
Merge e8047d851 into b84b29b9b
Pull Request #23133: Add buildctl engine

215 of 296 new or added lines in 13 files covered. (72.64%)

233 existing lines in 12 files now uncovered.

91363 of 98645 relevant lines covered (92.62%)

4.05 hits per line

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

95.45
/src/python/pants/backend/docker/package_types.py
1
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
10✔
5

6
from dataclasses import dataclass
10✔
7
from enum import StrEnum, auto
10✔
8

9
from pants.core.goals.package import BuiltPackageArtifact
10✔
10
from pants.engine.addresses import Address
10✔
11
from pants.util.strutil import bullet_list, pluralize
10✔
12

13

14
class DockerPushOnPackageBehavior(StrEnum):
10✔
15
    """Controls whether Docker images can push to registries during packaging."""
16

17
    ALLOW = auto()
10✔
18
    IGNORE = auto()
10✔
19
    WARN = auto()
10✔
20
    ERROR = auto()
10✔
21

22

23
class DockerPushOnPackageException(Exception):
10✔
24
    """Exception raised when a Docker image would push but push behavior is ERROR."""
25

26
    def __init__(self, address: Address):
10✔
UNCOV
27
        super().__init__(
×
28
            f"The docker_image target {address} would push to a registry but "
29
            f'`[docker].push_on_package` is set to "error".'
30
        )
31

32

33
@dataclass(frozen=True)
10✔
34
class BuiltDockerImage(BuiltPackageArtifact):
10✔
35
    # We don't really want a default for this field, but the superclass has a field with
36
    # a default, so all subsequent fields must have one too. The `create()` method below
37
    # will ensure that this field is properly populated in practice.
38
    image_id: str = ""
10✔
39
    tags: tuple[str, ...] = ()
10✔
40

41
    @classmethod
10✔
42
    def create(
10✔
43
        cls, image_id: str, tags: tuple[str, ...], metadata_filename: str
44
    ) -> BuiltDockerImage:
45
        tags_string = tags[0] if len(tags) == 1 else f"\n{bullet_list(tags)}"
1✔
46
        return cls(
1✔
47
            image_id=image_id,
48
            tags=tags,
49
            relpath=metadata_filename,
50
            extra_log_lines=(
51
                f"Built docker {pluralize(len(tags), 'image', False)}: {tags_string}",
52
                f"Docker image ID: {image_id}",
53
            ),
54
        )
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

© 2026 Coveralls, Inc