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

pantsbuild / pants / 22285099215

22 Feb 2026 08:52PM UTC coverage: 75.854% (-17.1%) from 92.936%
22285099215

Pull #23121

github

web-flow
Merge c7299df9c into ba8359840
Pull Request #23121: fix issue with optional fields in dependency validator

28 of 29 new or added lines in 2 files covered. (96.55%)

11174 existing lines in 400 files now uncovered.

53694 of 70786 relevant lines covered (75.85%)

1.88 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
4✔
5

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

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

13

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

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

22

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

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

41
    @classmethod
4✔
42
    def create(
4✔
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