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

pantsbuild / pants / 22893710013

10 Mar 2026 08:29AM UTC coverage: 91.148% (-1.8%) from 92.932%
22893710013

Pull #23032

github

web-flow
Merge c09ecdff4 into 2804a4673
Pull Request #23032: Bugfix: Add support for pull option in podman

87 of 93 new or added lines in 4 files covered. (93.55%)

1432 existing lines in 69 files now uncovered.

84014 of 92173 relevant lines covered (91.15%)

3.91 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
9✔
5

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

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

13

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

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

22

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

26
    def __init__(self, address: Address):
9✔
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)
9✔
34
class BuiltDockerImage(BuiltPackageArtifact):
9✔
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 = ""
9✔
39
    tags: tuple[str, ...] = ()
9✔
40

41
    @classmethod
9✔
42
    def create(
9✔
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)}"
4✔
46
        return cls(
4✔
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