Skip to content

Commit 6b19c10

Browse files
authored
Merge pull request #358 from konflux-ci/fix-revert
Revert "fix: treat `FROM oci-archive:` like `FROM scratch` for base i…
2 parents 737b4f4 + f80ec85 commit 6b19c10

2 files changed

Lines changed: 3 additions & 33 deletions

File tree

src/mobster/cmd/generate/oci_image/base_images_dockerfile.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ async def get_base_images_refs_from_dockerfile(
4141
Returns:
4242
list[str | None]: List of base images used during build as extracted
4343
from the dockerfile in the order they were used.
44-
`FROM scratch` and `FROM oci-archive:` are
45-
identified as `None`.
44+
`FROM SCRATCH` is identified as `None`.
4645
4746
Example:
4847
If the Dockerfile looks like
@@ -80,13 +79,8 @@ async def get_base_images_refs_from_dockerfile(
8079
base_images_pullspecs.append(None)
8180
is_actually_image = False
8281
base_name: str = stage.get("BaseName")
83-
if is_actually_image and base_name and base_name.startswith("oci-archive:"):
84-
# oci-archive references are not real base images (used by e.g.
85-
# bootc, chunkah, and flatpak builds). Treat them like scratch so
86-
# that preceding stages still get recorded as builder images.
87-
base_images_pullspecs.append(None)
88-
is_actually_image = False
89-
if is_actually_image and base_name:
82+
if is_actually_image and base_name and not base_name.startswith("oci-archive:"):
83+
# flatpak archives are not real base images. So we skip them
9084
base_images_pullspecs.append(base_name.strip("'\""))
9185

9286
# Don't include images after the target used for build

tests/cmd/generate/oci_image/test_base_images_dockerfile.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -109,30 +109,6 @@ async def test_get_base_images_refs_from_dockerfile(
109109
)
110110

111111

112-
@pytest.mark.asyncio
113-
async def test_get_base_images_refs_from_dockerfile_oci_archive() -> None:
114-
"""FROM oci-archive: should be treated like FROM scratch (appends None)."""
115-
parsed_dockerfile = {
116-
"Stages": [
117-
{
118-
"BaseName": "quay.io/example/builder:latest",
119-
"As": "builder",
120-
"From": {"Image": "quay.io/example/builder:latest"},
121-
"Commands": [],
122-
},
123-
{
124-
"BaseName": "oci-archive:out.ociarchive",
125-
"From": {"Image": "oci-archive:out.ociarchive"},
126-
"Commands": [],
127-
},
128-
]
129-
}
130-
assert await get_base_images_refs_from_dockerfile(parsed_dockerfile) == [
131-
"quay.io/example/builder:latest",
132-
None,
133-
]
134-
135-
136112
@pytest.mark.asyncio
137113
@pytest.mark.parametrize(
138114
["file_content", "expected_dict"],

0 commit comments

Comments
 (0)