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

pantsbuild / pants / 20632486505

01 Jan 2026 04:21AM UTC coverage: 43.231% (-37.1%) from 80.281%
20632486505

Pull #22962

github

web-flow
Merge 08d5c63b0 into f52ab6675
Pull Request #22962: Bump the gha-deps group across 1 directory with 6 updates

26122 of 60424 relevant lines covered (43.23%)

0.86 hits per line

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

0.0
/src/python/pants/backend/docker/goals/tailor.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
×
5

6
import os
×
7
from dataclasses import dataclass
×
8

9
from pants.backend.docker.subsystems.docker_options import DockerOptions
×
10
from pants.backend.docker.target_types import DockerImageSourceField, DockerImageTarget
×
11
from pants.core.goals.tailor import (
×
12
    AllOwnedSources,
13
    PutativeTarget,
14
    PutativeTargets,
15
    PutativeTargetsRequest,
16
)
17
from pants.engine.intrinsics import path_globs_to_paths
×
18
from pants.engine.rules import collect_rules, rule
×
19
from pants.engine.unions import UnionRule
×
20
from pants.util.logging import LogLevel
×
21

22

23
@dataclass(frozen=True)
×
24
class PutativeDockerTargetsRequest(PutativeTargetsRequest):
×
25
    pass
×
26

27

28
@rule(level=LogLevel.DEBUG, desc="Determine candidate Docker targets to create")
×
29
async def find_putative_targets(
×
30
    req: PutativeDockerTargetsRequest, all_owned_sources: AllOwnedSources, docker: DockerOptions
31
) -> PutativeTargets:
32
    if not docker.tailor:
×
33
        return PutativeTargets()
×
34

35
    all_dockerfiles = await path_globs_to_paths(req.path_globs("*Dockerfile*"))
×
36
    unowned_dockerfiles = set(all_dockerfiles.files) - set(all_owned_sources)
×
37
    pts = []
×
38
    for dockerfile in sorted(unowned_dockerfiles):
×
39
        dirname, filename = os.path.split(dockerfile)
×
40
        kwargs = {} if filename == DockerImageSourceField.default else {"source": filename}
×
41
        pts.append(
×
42
            PutativeTarget.for_target_type(
43
                DockerImageTarget,
44
                path=dirname,
45
                name="docker",
46
                triggering_sources=[filename],
47
                kwargs=kwargs,
48
            )
49
        )
50
    return PutativeTargets(pts)
×
51

52

53
def rules():
×
54
    return [
×
55
        *collect_rules(),
56
        UnionRule(PutativeTargetsRequest, PutativeDockerTargetsRequest),
57
    ]
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