Skip to content

ci-operator: add automatic dockerfile inputs detection - #4851

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
Prucek:dockerfile-inputs
Jan 20, 2026
Merged

ci-operator: add automatic dockerfile inputs detection#4851
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
Prucek:dockerfile-inputs

Conversation

@Prucek

@Prucek Prucek commented Nov 24, 2025

Copy link
Copy Markdown
Member

Added pkg/dockerfile/inputs.go - Core detection logic:

  • Automatically detects registry.ci.openshift.org and quay-proxy.ci.openshift.org references in Dockerfiles
  • Parses references into org/repo/tag components
  • Generates base_images and inputs.as[] configuration on-the-fly
  • Using registry-replacer's detection logic

Integrated into pkg/defaults/defaults.go:

  • New detectDockerfileInputs() function reads Dockerfiles from source checkout
  • Calls DetectInputsFromDockerfile() during build graph construction
  • Creates input steps that tag detected base images into the pipeline ImageStream
  • Respects manual configuration (manual inputs.as[] takes precedence)

Real example config using a mocked prowjob: https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_cluster-api-operator/63/prucek-test-dockerfile-inputs/2009259226555224064

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repository is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai

coderabbitai Bot commented Nov 24, 2025

Copy link
Copy Markdown

Walkthrough

Introduces Dockerfile-based input detection by creating new parsing utilities for extracting registry references and parsing pull strings, integrating them into build step generation, and refactoring registry-replacer to use shared utilities with comprehensive test coverage.

Changes

Cohort / File(s) Summary
Dockerfile Parsing & Registry Detection
pkg/dockerfile/extract.go, pkg/dockerfile/extract_test.go
Adds RegistryRegex pattern, OrgRepoTag struct, and utility functions (ExtractRegistryReferences, OrgRepoTagFromPullString, HasManualReplacementFor) to extract and parse registry references from Dockerfiles. Handles both standard and quay-proxy reference formats. Comprehensive test coverage for various pull string formats.
Dockerfile Input Detection
pkg/dockerfile/inputs.go, pkg/dockerfile/inputs_test.go
Adds DetectInputsFromDockerfile function to scan Dockerfiles for registry references and map them to ImageStreamTagReference entries. Skips existing manual replacements and provides deduplicated results. Tests validate single/multiple registry references, quay-proxy handling, and deduplication.
Build Defaults Integration
pkg/defaults/defaults.go, pkg/defaults/defaults_test.go
Integrates Dockerfile input detection into build step generation via detectDockerfileInputs. Adds dockerfileDetails struct and helper functions (readDockerfileForImage, processDetectedBaseImages, appendInputs, isBaseImagePresent) to read Dockerfiles, detect base images, and generate InputImageTagStepConfiguration steps. Includes error logging and debug information on read failures. Substantial test coverage with multiple scenarios.
Registry Replacer Refactoring
cmd/registry-replacer/main.go, cmd/registry-replacer/main_test.go
Refactors ensureReplacement to use dockerfile package utilities (ExtractRegistryReferences, OrgRepoTagFromPullString, HasManualReplacementFor) instead of local implementations. Removes deprecated orgRepoTag type and local parsing functions. Updates all field references to use cidockerfile.OrgRepoTag (Org, Repo, Tag). Removes TestOrgRepoTagFromPullString test; updates remaining tests to use new ptr utilities.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

✨ Finishing touches
  • 📝 Generate docstrings

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

Command failed


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 24, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
pkg/defaults/defaults_test.go (1)

2445-2457: Prefer standard library strings.Contains.

These helper functions reimplement functionality available in the standard library. Using strings.Contains directly would simplify the code and improve maintainability.

Apply this diff:

-func containsString(s, substr string) bool {
-	return len(s) >= len(substr) && (s == substr || len(substr) == 0 ||
-		(len(s) > 0 && len(substr) > 0 && contains(s, substr)))
-}
-
-func contains(s, substr string) bool {
-	for i := 0; i <= len(s)-len(substr); i++ {
-		if s[i:i+len(substr)] == substr {
-			return true
-		}
-	}
-	return false
-}

Then update line 2237 to use strings.Contains directly:

+import "strings"
+
 				if tc.expectedErrContain != "" && err != nil {
-					if !containsString(err.Error(), tc.expectedErrContain) {
+					if !strings.Contains(err.Error(), tc.expectedErrContain) {
 						t.Errorf("expected error to contain %q, got: %v", tc.expectedErrContain, err)
 					}
 				}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 7c717b8 and fdaf457.

📒 Files selected for processing (12)
  • pkg/defaults/defaults.go (2 hunks)
  • pkg/defaults/defaults_test.go (3 hunks)
  • pkg/dockerfile/inputs.go (1 hunks)
  • pkg/dockerfile/inputs_test.go (1 hunks)
  • test/e2e/dockerfile-inputs/config.yaml (1 hunks)
  • test/e2e/dockerfile-inputs/e2e_test.go (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.copy-from (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.manual (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.multiple (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.quay-proxy (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.single (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/dockerfile-inputs/config.yaml
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.quay-proxy
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.manual
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.multiple
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.copy-from
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs
  • pkg/dockerfile/inputs_test.go
  • pkg/dockerfile/inputs.go
  • pkg/defaults/defaults_test.go
  • pkg/defaults/defaults.go
  • test/e2e/dockerfile-inputs/e2e_test.go
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.single
🧬 Code graph analysis (4)
pkg/dockerfile/inputs_test.go (2)
pkg/api/types.go (2)
  • ImageBuildInputs (2748-2758)
  • ImageStreamTagReference (494-501)
pkg/dockerfile/inputs.go (1)
  • DetectInputsFromDockerfile (33-90)
pkg/dockerfile/inputs.go (1)
pkg/api/types.go (2)
  • ImageBuildInputs (2748-2758)
  • ImageStreamTagReference (494-501)
pkg/defaults/defaults.go (3)
pkg/api/types.go (9)
  • ReleaseBuildConfiguration (37-135)
  • StepConfiguration (618-632)
  • ProjectDirectoryImageBuildStepConfiguration (2661-2684)
  • ImageBuildInputs (2748-2758)
  • ImageStreamTagReference (494-501)
  • InputImageTagStepConfiguration (638-641)
  • InputImage (680-687)
  • PipelineImageStreamTagReference (2493-2493)
  • ImageStreamSource (699-702)
pkg/dockerfile/inputs.go (1)
  • DetectInputsFromDockerfile (33-90)
cmd/repo-init/api.go (1)
  • BaseImages (69-69)
test/e2e/dockerfile-inputs/e2e_test.go (1)
pkg/testhelper/accessory.go (1)
  • T (51-57)
🔇 Additional comments (15)
test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs (1)

1-2: LGTM!

Appropriate test fixture for verifying the "no registry references" detection path.

test/e2e/dockerfile-inputs/testdata/Dockerfile.manual (1)

1-2: LGTM!

Appropriate fixture for testing manual inputs precedence over auto-detection.

test/e2e/dockerfile-inputs/testdata/Dockerfile.quay-proxy (1)

1-2: LGTM!

Appropriate test fixture for verifying quay-proxy reference detection and parsing.

test/e2e/dockerfile-inputs/testdata/Dockerfile.single (1)

1-2: LGTM!

Appropriate fixture for the basic single-reference auto-detection scenario.

test/e2e/dockerfile-inputs/testdata/Dockerfile.multiple (1)

1-6: LGTM!

Appropriate multi-stage fixture for testing detection of multiple base image references.

test/e2e/dockerfile-inputs/testdata/Dockerfile.copy-from (1)

1-6: LGTM!

Appropriate fixture for testing COPY --from directive handling in multi-stage builds.

pkg/defaults/defaults_test.go (2)

7-7: LGTM!

The new imports are appropriately used in the test functions.

Also applies to: 20-20


2138-2443: Comprehensive test coverage.

The test functions provide thorough coverage of Dockerfile reading and base image detection scenarios, including edge cases for custom paths, literals, manual inputs, and multi-stage builds.

test/e2e/dockerfile-inputs/config.yaml (1)

1-30: LGTM!

Well-structured e2e test configuration that covers the key scenarios: single/multiple auto-detection, quay-proxy references, manual inputs precedence, COPY --from handling, and no-registry-references cases.

pkg/defaults/defaults.go (1)

1029-1137: LGTM: Clean integration of Dockerfile input detection.

The implementation follows good practices:

  • Soft-fail approach (logs and continues) for individual image failures is appropriate, as one malformed Dockerfile shouldn't block the entire build
  • Functions are well-factored and focused on single responsibilities
  • Error handling is consistent with the rest of the codebase
  • Mutations to config.BaseImages and image.Inputs follow existing patterns in this file
test/e2e/dockerfile-inputs/e2e_test.go (1)

12-90: LGTM: Comprehensive e2e test coverage.

The test cases cover the key scenarios:

  • Auto-detection of single and multiple registry references
  • Quay-proxy reference handling
  • Manual input override behavior
  • COPY --from references
  • No registry references case

Test structure is clean and maintainable.

pkg/dockerfile/inputs_test.go (1)

11-293: LGTM: Thorough unit test coverage.

The test suite covers:

  • Edge cases (empty dockerfile, duplicates, mixed registry/non-registry refs)
  • Multiple registry formats (registry.ci, registry.svc.ci, quay-proxy)
  • Error conditions (malformed references)
  • Manual input override behavior

Good use of table-driven tests and clear assertions.

pkg/dockerfile/inputs.go (3)

18-19: Regex pattern is permissive but acceptable.

The pattern \S+ matches any non-whitespace characters after the registry domain, which is quite permissive. However, this is acceptable because:

  1. orgRepoTagFromPullString() validates the format downstream (Lines 138-162)
  2. Invalid formats are caught and returned as errors
  3. The simple approach aligns with the stated goal of parity with registry-replacer

33-90: LGTM: Well-structured detection logic.

The function correctly:

  • Returns early for empty input or when manual inputs are defined
  • Deduplicates registry references
  • Handles parsing errors appropriately
  • Logs useful diagnostic information at appropriate levels

The approach of honoring manual inputs.as[] configuration while auto-detecting when not present is the right design choice.


181-220: Incorrect review comment. The function extractReplacementCandidatesFromDockerfile at pkg/dockerfile/inputs.go:183 IS actively called in the codebase at cmd/registry-replacer/main.go:305. It is not dead code or unused. The function serves its intended purpose within the codebase.

Likely an incorrect or invalid review comment.

@Prucek

Prucek commented Nov 25, 2025

Copy link
Copy Markdown
Member Author

/test e2e

Comment thread pkg/defaults/defaults.go Outdated
@droslean

Copy link
Copy Markdown
Member

/test images

@Prucek

Prucek commented Nov 27, 2025

Copy link
Copy Markdown
Member Author

/test e2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
pkg/dockerfile/inputs.go (1)

93-101: Clarify or remove currently-unused per-reference manual override helper

hasManualInputs short-circuits auto-detection when any inputs.as entry is present, which matches the intended “manual config wins” semantics. Given that, the per-reference helper hasManualReplacementFor is currently unreachable in production: with the existing call pattern it can only run in cases where there are no manual inputs.as entries.

That’s not harmful but slightly confusing for future readers. Two options:

  • If you plan to support a “mixed” mode (some refs auto-detected, some overridden manually), add a comment on DetectInputsFromDockerfile explaining the intended future use of hasManualReplacementFor, or adjust the short-circuit logic accordingly.
  • If not, consider dropping hasManualReplacementFor for now and reintroducing it when such a mode is actually needed.

This keeps the detection path easier to reason about and avoids dead-code-like helpers.

Also applies to: 129-137

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between fdaf457 and f2792f4.

📒 Files selected for processing (12)
  • pkg/defaults/defaults.go (2 hunks)
  • pkg/defaults/defaults_test.go (3 hunks)
  • pkg/dockerfile/inputs.go (1 hunks)
  • pkg/dockerfile/inputs_test.go (1 hunks)
  • test/e2e/dockerfile-inputs/config.yaml (1 hunks)
  • test/e2e/dockerfile-inputs/e2e_test.go (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.copy-from (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.manual (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.multiple (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.quay-proxy (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.single (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.quay-proxy
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.manual
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.single
  • pkg/defaults/defaults_test.go
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.copy-from
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.multiple
  • test/e2e/dockerfile-inputs/config.yaml
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs
  • test/e2e/dockerfile-inputs/e2e_test.go
  • pkg/defaults/defaults.go
  • pkg/dockerfile/inputs.go
  • pkg/dockerfile/inputs_test.go
🧬 Code graph analysis (2)
test/e2e/dockerfile-inputs/e2e_test.go (1)
pkg/testhelper/accessory.go (1)
  • T (51-57)
pkg/dockerfile/inputs.go (1)
pkg/api/types.go (2)
  • ImageBuildInputs (2748-2758)
  • ImageStreamTagReference (494-501)
🔇 Additional comments (3)
test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs (1)

1-2: No-registry fixture correctly exercises negative path

This Dockerfile intentionally contains no registry.ci.openshift.org/quay-proxy refs and is appropriate for the "no auto-detect" scenario.

test/e2e/dockerfile-inputs/e2e_test.go (1)

1-90: E2E coverage for Dockerfile inputs is comprehensive and wired correctly

The table-driven TestDockerfileInputs exercises all key scenarios (single/multiple/quay-proxy/manual/COPY-from/no-refs) via the standard e2e framework, passing pull secrets and JOB_SPEC appropriately. Assertions on success and log output look sound.

pkg/dockerfile/inputs_test.go (1)

1-293: Unit tests thoroughly exercise detection and parsing helpers

TestDetectInputsFromDockerfile, TestOrgRepoTagFromPullString, and TestExtractReplacementCandidatesFromDockerfile collectively cover the important happy-path and edge cases (multiple registries, quay-proxy, legacy registry.svc, manual inputs, mixed/duplicate refs, and COPY/AS stages). This gives good confidence in the new parsing logic.

Comment thread pkg/defaults/defaults.go
Comment thread pkg/dockerfile/inputs.go Outdated
@Prucek

Prucek commented Nov 27, 2025

Copy link
Copy Markdown
Member Author

/test images

@Prucek

Prucek commented Nov 28, 2025

Copy link
Copy Markdown
Member Author

/test e2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between eede1fe and b1d622c.

📒 Files selected for processing (8)
  • test/e2e/dockerfile-inputs/config.yaml (1 hunks)
  • test/e2e/dockerfile-inputs/e2e_test.go (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.copy-from (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.manual (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.multiple (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.quay-proxy (1 hunks)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.single (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.manual
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.quay-proxy
  • test/e2e/dockerfile-inputs/config.yaml
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.single
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.multiple
  • test/e2e/dockerfile-inputs/testdata/Dockerfile.copy-from
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs
  • test/e2e/dockerfile-inputs/e2e_test.go
🧬 Code graph analysis (1)
test/e2e/dockerfile-inputs/e2e_test.go (1)
pkg/testhelper/accessory.go (1)
  • T (51-57)
🔇 Additional comments (3)
test/e2e/dockerfile-inputs/testdata/Dockerfile.no-refs (1)

1-2: LGTM!

Valid test fixture for the no-registry-references case. The Dockerfile correctly uses a public base image and explicitly documents the test intent.

test/e2e/dockerfile-inputs/e2e_test.go (2)

1-13: LGTM!

Standard e2e test structure with appropriate build tags and minimal imports. The defaultJobSpec is lengthy but acceptable as test fixture data.


15-73: LGTM!

Comprehensive test coverage with clear table-driven structure. The test cases appropriately cover various scenarios including single/multiple references, quay-proxy, manual overrides, COPY --from, and the no-references case.

@Prucek

Prucek commented Dec 2, 2025

Copy link
Copy Markdown
Member Author

/test e2e

@Prucek
Prucek force-pushed the dockerfile-inputs branch from b1d622c to 4c6b6d5 Compare January 6, 2026 14:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI Agents
In @pkg/defaults/defaults.go:
- Around line 1039-1044: The call to detectDockerfileInputs currently propagates
errors and aborts graph construction; change it to treat errors as non-fatal:
call detectDockerfileInputs(config, readFile), and if it returns an error log a
warning (using the package's logger) that includes the error message and
context, do not return the error, and only append returned dockerfileInputSteps
to buildSteps when non-nil/non-empty so auto-detection stays additive rather
than failing the build graph.

In @pkg/dockerfile/inputs.go:
- Around line 58-61: The code currently treats a failure from
orgRepoTagFromPullString(ref) as fatal; change this to a best-effort approach by
catching the error, emitting a warning (using the existing logger in scope) that
includes ref and the error, and skipping/continuing past this ref instead of
returning the error so processing can continue for other entries; make this
change around the orgRepoTagFromPullString call and ensure any downstream code
that expects orgRepoTag is not executed when parsing fails.
🧹 Nitpick comments (1)
pkg/dockerfile/inputs.go (1)

96-99: Inconsistent case handling for Dockerfile instructions

Dockerfile instructions are case-insensitive. The check includes lowercase copy but not lowercase from, which could miss valid references.

🔎 Proposed fix
 	for _, line := range bytes.Split(dockerfile, []byte("\n")) {
-		if !bytes.Contains(line, []byte("FROM")) && !bytes.Contains(line, []byte("COPY")) && !bytes.Contains(line, []byte("copy")) {
+		upperLine := bytes.ToUpper(line)
+		if !bytes.Contains(upperLine, []byte("FROM")) && !bytes.Contains(upperLine, []byte("COPY")) {
 			continue
 		}
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between b1d622c and 4c6b6d5.

📒 Files selected for processing (6)
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
  • pkg/dockerfile/inputs.go
  • pkg/dockerfile/inputs_test.go
  • test/e2e/dockerfile-inputs/config.yaml
  • test/e2e/dockerfile-inputs/e2e_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/dockerfile/inputs_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/defaults/defaults_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/dockerfile-inputs/e2e_test.go
  • test/e2e/dockerfile-inputs/config.yaml
  • pkg/defaults/defaults.go
  • pkg/dockerfile/inputs.go
🧬 Code graph analysis (3)
test/e2e/dockerfile-inputs/e2e_test.go (1)
pkg/testhelper/accessory.go (1)
  • T (51-57)
pkg/defaults/defaults.go (2)
pkg/api/types.go (7)
  • StepConfiguration (623-637)
  • ProjectDirectoryImageBuildStepConfiguration (2699-2722)
  • ImageBuildInputs (2786-2796)
  • ImageStreamTagReference (499-506)
  • InputImageTagStepConfiguration (643-646)
  • InputImage (685-692)
  • ReleaseTagConfiguration (516-532)
pkg/dockerfile/inputs.go (1)
  • DetectInputsFromDockerfile (34-79)
pkg/dockerfile/inputs.go (1)
pkg/api/types.go (2)
  • ImageBuildInputs (2786-2796)
  • ImageStreamTagReference (499-506)
🔇 Additional comments (4)
pkg/defaults/defaults.go (1)

1098-1141: LGTM!

The function correctly detects base images, updates the configuration, and generates appropriate InputImageTagStepConfiguration steps. The mutation of config.BaseImages and image.Inputs is intentional for proper pipeline integration.

test/e2e/dockerfile-inputs/config.yaml (1)

1-67: LGTM!

The test configuration provides good coverage of Dockerfile input detection scenarios: single/multiple registry references, quay-proxy format, manual inputs override, COPY --from handling, and no-registry-refs case.

test/e2e/dockerfile-inputs/e2e_test.go (1)

12-100: LGTM!

The table-driven test structure provides comprehensive coverage of the Dockerfile input detection feature. Test cases align well with the scenarios defined in config.yaml.

pkg/dockerfile/inputs.go (1)

169-208: These functions are actively used in the codebase. extractReplacementCandidatesFromDockerfile is called in pkg/dockerfile/inputs_test.go:270 and cmd/registry-replacer/main.go:305, while nodeHasFromRef is used in cmd/registry-replacer/main.go:565 and within the extraction function itself at line 196.

Likely an incorrect or invalid review comment.

Comment thread pkg/defaults/defaults.go
Comment thread pkg/dockerfile/inputs.go Outdated
Comment thread test/e2e/dockerfile-inputs/e2e_test.go Outdated
@Prucek

Prucek commented Jan 6, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@Prucek
Prucek force-pushed the dockerfile-inputs branch from 4c6b6d5 to 275363c Compare January 7, 2026 14:19
@Prucek

Prucek commented Jan 7, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@Prucek
Prucek force-pushed the dockerfile-inputs branch from 275363c to 966e16b Compare January 7, 2026 14:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @pkg/dockerfile/inputs_test.go:
- Around line 185-190: Update the test case name string "wrong reguistry format"
to the correct spelling "wrong registry format" in the table-driven test entry
(the struct literal with fields name, pullString, expected, expectError) so the
test description is accurate; search for the entry containing pullString
"registry.ci.openshift.org/ocp:latest" or the name value to locate and fix it.
🧹 Nitpick comments (2)
pkg/dockerfile/inputs.go (1)

75-78: Dockerfile instructions are case-insensitive; consider normalizing

The check filters lines containing FROM, COPY, or copy, but Dockerfile instructions are case-insensitive. A line like from registry.ci... or From registry.ci... would be skipped.

♻️ Suggested fix
 	for _, line := range bytes.Split(dockerfile, []byte("\n")) {
-		if !bytes.Contains(line, []byte("FROM")) && !bytes.Contains(line, []byte("COPY")) && !bytes.Contains(line, []byte("copy")) {
+		upperLine := bytes.ToUpper(line)
+		if !bytes.Contains(upperLine, []byte("FROM")) && !bytes.Contains(upperLine, []byte("COPY")) {
 			continue
 		}
pkg/defaults/defaults.go (1)

1065-1068: Inconsistent error handling: consider making processing failures best-effort too

Read failures at lines 1056-1059 are gracefully skipped with a debug log, but processing failures here are fatal. For consistency with the best-effort approach, consider logging a warning and continuing instead.

♻️ Suggested fix
 		imageSteps, err := processDetectedBaseImages(config, image, dockerfileContent, dockerfilePath)
 		if err != nil {
-			return nil, err
+			logrus.WithError(err).WithField("image", image.To).Warn("Failed to process detected base images, skipping")
+			continue
 		}
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 4c6b6d5 and 966e16b.

📒 Files selected for processing (6)
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
  • pkg/dockerfile/inputs.go
  • pkg/dockerfile/inputs_test.go
  • test/e2e/dockerfile-inputs/config.yaml
  • test/e2e/dockerfile-inputs/e2e_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/defaults/defaults_test.go
  • test/e2e/dockerfile-inputs/config.yaml
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/dockerfile-inputs/e2e_test.go
  • pkg/dockerfile/inputs.go
  • pkg/defaults/defaults.go
  • pkg/dockerfile/inputs_test.go
🧬 Code graph analysis (3)
test/e2e/dockerfile-inputs/e2e_test.go (1)
pkg/testhelper/accessory.go (1)
  • T (51-57)
pkg/dockerfile/inputs.go (1)
pkg/api/types.go (2)
  • ImageBuildInputs (2786-2796)
  • ImageStreamTagReference (499-506)
pkg/defaults/defaults.go (2)
pkg/api/types.go (8)
  • StepConfiguration (623-637)
  • ImageBuildInputs (2786-2796)
  • ImageStreamTagReference (499-506)
  • InputImageTagStepConfiguration (643-646)
  • InputImage (685-692)
  • PipelineImageStreamTagReference (2531-2531)
  • ImageStreamSource (704-707)
  • ImageStreamSourceBase (698-698)
pkg/dockerfile/inputs.go (1)
  • DetectInputsFromDockerfile (34-68)
🔇 Additional comments (7)
pkg/dockerfile/inputs.go (2)

108-129: LGTM!

The parsing logic correctly handles both standard registry references and the special quay-proxy format with underscore-encoded tags.


148-187: The function is actively used in production code at cmd/registry-replacer/main.go:305, so no action is needed here.

Likely an incorrect or invalid review comment.

pkg/defaults/defaults.go (2)

1075-1096: LGTM!

The function structure is clean with an early return for the literal case, and the path construction logic correctly handles the various configuration options.


1119-1147: LGTM!

The logic correctly handles duplicate detection via isBaseImagePresent, adds new base images to the configuration, and creates appropriate InputImageTagStepConfiguration entries. The informative logging will help users understand what's being auto-detected.

test/e2e/dockerfile-inputs/e2e_test.go (1)

21-34: LGTM!

Good coverage of the expected detection scenarios including single/multiple references, quay-proxy format, manual input skipping, and existing base image matching.

pkg/dockerfile/inputs_test.go (2)

11-167: LGTM!

Comprehensive test coverage including empty dockerfile, single/multiple registry references, quay-proxy variants, manual replacement skipping, non-registry references, mixed scenarios, and duplicate handling.


226-293: LGTM!

Good test coverage for the replacement candidates extraction, including multi-stage builds and COPY --from scenarios.

@Prucek
Prucek force-pushed the dockerfile-inputs branch from 966e16b to 041eb39 Compare January 8, 2026 12:51
@Prucek

Prucek commented Jan 8, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @pkg/defaults/defaults.go:
- Around line 1128-1134: When isBaseImagePresent returns a presentAlias but the
matched presentBaseImage has an empty As, avoid inserting an empty string into
image.Inputs[presentAlias].As; update the block that assigns
image.Inputs[presentAlias] so it checks presentBaseImage.As and if empty uses
presentAlias (or otherwise omits the As slice), e.g. compute a non-empty asValue
= presentBaseImage.As != "" ? presentBaseImage.As : presentAlias and set
ImageBuildInputs.As to []string{asValue}; alternatively add a validation step in
config loading to ensure BaseImages always have As populated.

In @pkg/dockerfile/inputs_test.go:
- Around line 185-190: Update the test case name string to correct the typo:
change the "name" field value in the failing test case from "wrong reguistry
format" to "wrong registry format" in the test table entry (the struct literal
with pullString "registry.ci.openshift.org/ocp:latest" and expectError true) so
the test description is spelled correctly.
🧹 Nitpick comments (1)
pkg/defaults/defaults.go (1)

1084-1092: Consider consistent path formatting.

The path construction prepends ./ when there's no ContextDir (line 1091), but doesn't for paths with ContextDir (line 1089). This inconsistency is minor but could cause confusion in log messages.

♻️ Suggested fix for consistency
 	if image.ContextDir != "" {
 		dockerfilePath = fmt.Sprintf("%s/%s", image.ContextDir, dockerfilePath)
-	} else {
-		dockerfilePath = fmt.Sprintf("./%s", dockerfilePath)
 	}
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 966e16b and 041eb39.

📒 Files selected for processing (7)
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
  • pkg/dockerfile/inputs.go
  • pkg/dockerfile/inputs_test.go
  • test/e2e/dockerfile-inputs/e2e_test.go
  • test/e2e/dockerfile-inputs/testdata/config.yaml
  • test/e2e/dockerfile-inputs/testdata/real.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/e2e/dockerfile-inputs/e2e_test.go
  • pkg/dockerfile/inputs.go
  • pkg/defaults/defaults_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/dockerfile-inputs/testdata/config.yaml
  • pkg/defaults/defaults.go
  • test/e2e/dockerfile-inputs/testdata/real.yaml
  • pkg/dockerfile/inputs_test.go
🧬 Code graph analysis (2)
pkg/defaults/defaults.go (2)
pkg/api/types.go (7)
  • StepConfiguration (623-637)
  • ImageBuildInputs (2792-2802)
  • ImageStreamTagReference (499-506)
  • InputImageTagStepConfiguration (643-646)
  • InputImage (685-692)
  • ImageStreamSource (704-707)
  • ImageStreamSourceBase (698-698)
pkg/dockerfile/inputs.go (1)
  • DetectInputsFromDockerfile (34-68)
pkg/dockerfile/inputs_test.go (2)
pkg/api/types.go (2)
  • ImageBuildInputs (2792-2802)
  • ImageStreamTagReference (499-506)
pkg/dockerfile/inputs.go (1)
  • DetectInputsFromDockerfile (34-68)
🔇 Additional comments (7)
pkg/defaults/defaults.go (3)

1041-1047: LGTM on integration point.

The integration of Dockerfile input detection is cleanly placed after source steps and before returning build steps. Error handling properly wraps and propagates failures.


1051-1075: LGTM on detection orchestration.

The function appropriately handles read failures gracefully by logging at debug level and continuing. This ensures the auto-detection feature doesn't break builds when Dockerfiles are unavailable or malformed.


1156-1163: LGTM on base image presence check.

The comparison correctly uses the image identity fields (Namespace, Name, Tag) while excluding As which is just an alias.

pkg/dockerfile/inputs_test.go (2)

11-167: Solid test coverage for DetectInputsFromDockerfile.

The test cases comprehensively cover the main scenarios including empty input, single/multiple references, different registry formats (registry.ci.openshift.org, quay-proxy, registry.svc.ci.openshift.org), manual replacement skipping, and deduplication.


226-293: LGTM on extraction tests.

Good coverage of FROM instruction parsing including multi-stage builds and COPY --from scenarios. The set membership verification approach is appropriate for unordered results.

test/e2e/dockerfile-inputs/testdata/real.yaml (1)

1-30: LGTM on realistic test configuration.

This configuration provides a real-world example that exercises the build pipeline with from_repository: true, external base images, and container-based tests. Good addition for e2e validation.

test/e2e/dockerfile-inputs/testdata/config.yaml (1)

1-71: Excellent test configuration coverage.

This config comprehensively tests the Dockerfile input detection feature including:

  • Single and multiple registry references
  • quay-proxy format handling
  • Manual input precedence (manual-inputs case)
  • COPY --from scenarios
  • Non-registry references (should be ignored)
  • Existing base image detection

The detect-existing-base-image case (lines 59-62) correctly tests against the os base image defined in lines 2-5, ensuring the duplicate detection logic works.

Comment thread pkg/dockerfile/inputs_test.go Outdated
@Prucek
Prucek force-pushed the dockerfile-inputs branch from 041eb39 to 36e9780 Compare January 8, 2026 13:27
@Prucek
Prucek force-pushed the dockerfile-inputs branch from 284953f to dba6f04 Compare January 14, 2026 10:27
@Prucek

Prucek commented Jan 14, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@pkg/defaults/defaults.go`:
- Around line 1096-1137: In processDetectedBaseImages, avoid clobbering
preconfigured image.Inputs and silently overwriting base image aliases: when
assigning image.Inputs[alias], merge the new As value into any existing
api.ImageBuildInputs (preserving existing Paths and other fields) instead of
replacing the struct; before writing (*baseImages)[alias] check for collisions
by comparing the existing baseImage reference and if different, compute a unique
alias (e.g., alias-2, incrementing suffix until unused), normalize the stored
baseImage.As to match the chosen alias, log the collision with both aliases and
chosen suffix, then write the unique alias into both *baseImages and
image.Inputs; update uses of alias (stepConfig To/Sources and logs) to use the
final resolved alias.
♻️ Duplicate comments (2)
test/e2e/dockerfile-inputs/e2e_test.go (1)

47-49: Split “unexpected success” vs “unexpected failure” error messages.

Current failure message is misleading when success == false but the command succeeds (and vice versa).

Proposed fix
-			if testCase.success != (err == nil) {
-				t.Fatalf("%s: didn't expect an error from ci-operator: %v; output:\n%v", testCase.name, err, string(output))
-			}
+			if testCase.success && err != nil {
+				t.Fatalf("%s: expected success but got error: %v; output:\n%v", testCase.name, err, string(output))
+			} else if !testCase.success && err == nil {
+				t.Fatalf("%s: expected failure but command succeeded; output:\n%v", testCase.name, string(output))
+			}
pkg/defaults/defaults.go (1)

1072-1094: Harden Dockerfile path handling (prevent .. escape / absolute paths; use filepath.Join). This currently allows traversal via ContextDir / DockerfilePath.

Proposed fix
 func readDockerfileForImage(image *api.ProjectDirectoryImageBuildStepConfiguration, readFile readFile) (dockerfileDetails, error) {
 	if image.DockerfileLiteral != nil {
 		return dockerfileDetails{content: []byte(*image.DockerfileLiteral), path: "dockerfile_literal"}, nil
 	}
 	details := dockerfileDetails{path: "Dockerfile"}
 	if image.DockerfilePath != "" {
 		details.path = image.DockerfilePath
 	}
-	dockerfilePath := fmt.Sprintf("./%s", details.path)
-	if image.ContextDir != "" {
-		dockerfilePath = fmt.Sprintf("%s/%s", image.ContextDir, details.path)
-	}
-	details.path = dockerfilePath
+	dockerfilePath := filepath.Join(".", details.path)
+	if image.ContextDir != "" {
+		dockerfilePath = filepath.Join(image.ContextDir, details.path)
+	}
+	dockerfilePath = filepath.Clean(dockerfilePath)
+	if filepath.IsAbs(dockerfilePath) ||
+		strings.HasPrefix(dockerfilePath, ".."+string(filepath.Separator)) || dockerfilePath == ".." {
+		return dockerfileDetails{}, fmt.Errorf("invalid Dockerfile path (escapes repo): %s", dockerfilePath)
+	}
+	details.path = dockerfilePath
 
 	dockerfileContent, err := readFile(details.path)
 	if err != nil {
 		return dockerfileDetails{}, fmt.Errorf("failed to read Dockerfile at %s: %w", dockerfilePath, err)
 	}
 	details.content = dockerfileContent
 	return details, nil
 }
🧹 Nitpick comments (2)
test/e2e/dockerfile-inputs/e2e_test.go (2)

13-13: Move the huge inline fakeJobSpec to testdata to reduce churn and improve readability.

Inlining the full JOB_SPEC JSON makes future updates noisy and hard to review. Consider placing it in testdata/job_spec.json and reading it in the test (keeping only the minimal fields ci-operator actually requires).

Proposed refactor (requires adding testdata/job_spec.json)
 import (
+	"os"
 	"testing"

 	"github.com/openshift/ci-tools/test/e2e/framework"
 )
 
 func TestDockerfileInputs(t *testing.T) {
-	const fakeJobSpec = `{"type":"postsubmit","job":"branch-ci-openshift-ci-tools-master-ci-operator-e2e","buildid":"0","prowjobid":"uuid","refs":{"org":"openshift","repo":"ci-tools","base_ref":"master","base_sha":"6d231cc37652e85e0f0e25c21088b73d644d89ad","pulls":[]},"decoration_config":{"timeout":"4h0m0s","grace_period":"30m0s","utility_images":{"clonerefs":"quay-proxy.ci.openshift.org/openshift/ci:ci_clonerefs_latest","initupload":"quay-proxy.ci.openshift.org/openshift/ci:ci_initupload_latest","entrypoint":"quay-proxy.ci.openshift.org/openshift/ci:ci_entrypoint_latest","sidecar":"quay-proxy.ci.openshift.org/openshift/ci:ci_sidecar_latest"},"resources":{"clonerefs":{"limits":{"memory":"3Gi"},"requests":{"cpu":"100m","memory":"500Mi"}},"initupload":{"limits":{"memory":"200Mi"},"requests":{"cpu":"100m","memory":"50Mi"}},"place_entrypoint":{"limits":{"memory":"100Mi"},"requests":{"cpu":"100m","memory":"25Mi"}},"sidecar":{"limits":{"memory":"2Gi"},"requests":{"cpu":"100m","memory":"250Mi"}}},"gcs_configuration":{"bucket":"test-platform-results","path_strategy":"single","default_org":"openshift","default_repo":"origin","mediaTypes":{"log":"text/plain"}},"gcs_credentials_secret":"gce-sa-credentials-gcs-publisher"}}`
+	fakeJobSpecBytes, err := os.ReadFile("testdata/job_spec.json")
+	if err != nil {
+		t.Fatalf("failed to read testdata/job_spec.json: %v", err)
+	}
+	fakeJobSpec := string(fakeJobSpecBytes)
 	var testCases = []struct {
 		name       string
 		args       []string
 		configPath string
 		jobSpec    string

28-36: Output assertions are likely brittle across log/message or release bumps; consider relaxing the match.

These exact strings (including specific OCP versions/tags) may need frequent updates even when behavior is correct. If framework.VerboseOutputContains supports it, prefer asserting on fewer/stable substrings (e.g., Detected base image, will tag into pipeline:) and the specific “manual inputs defined” behavior, instead of enumerating every detected tag.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 284953f and dba6f04.

📒 Files selected for processing (4)
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
  • test/e2e/dockerfile-inputs/e2e_test.go
  • test/e2e/dockerfile-inputs/testdata/config.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/e2e/dockerfile-inputs/testdata/config.yaml
  • pkg/defaults/defaults_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/dockerfile-inputs/e2e_test.go
  • pkg/defaults/defaults.go
🧬 Code graph analysis (1)
test/e2e/dockerfile-inputs/e2e_test.go (1)
pkg/testhelper/accessory.go (1)
  • T (51-57)
🔇 Additional comments (4)
pkg/defaults/defaults.go (4)

33-36: dockerfile import looks fine.


1039-1045: Nice integration point for auto-detected Dockerfile inputs. The detection is additive and doesn’t appear to fail graph construction.


1048-1070: Index-based loop is the right choice (mutations persist). Good call passing &images[i] so image.Inputs updates stick.


1139-1146: Helper looks correct for matching by (namespace, name, tag).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread pkg/defaults/defaults.go Outdated
@Prucek

Prucek commented Jan 14, 2026

Copy link
Copy Markdown
Member Author

/retest-required

@Prucek
Prucek force-pushed the dockerfile-inputs branch from dba6f04 to 7379518 Compare January 14, 2026 13:45
@Prucek

Prucek commented Jan 14, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@Prucek
Prucek force-pushed the dockerfile-inputs branch from 7379518 to e97062d Compare January 14, 2026 15:19
@Prucek

Prucek commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

/retest-required
/test e2e

@Prucek

Prucek commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@Prucek
Prucek force-pushed the dockerfile-inputs branch from e97062d to 70931eb Compare January 15, 2026 10:37
@Prucek

Prucek commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@Prucek
Prucek requested a review from droslean January 15, 2026 10:37
@Prucek

Prucek commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

/retest-required

@Prucek

Prucek commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

/test e2e

Comment thread pkg/defaults/defaults.go Outdated
Comment thread pkg/defaults/defaults.go Outdated
Comment thread pkg/defaults/defaults.go
// readDockerfileForImage reads the Dockerfile content for a given image configuration
// Returns content, a description of the source, and any error
func readDockerfileForImage(image *api.ProjectDirectoryImageBuildStepConfiguration, readFile readFile) (dockerfileDetails, error) {
if image.DockerfileLiteral != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check should be done outside this function since you are utilizing directly the image.DockerfileLiteral

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code is cleaner now. This is not better:

var dockerfileDetails dockerfileDetails
if image.DockerfileLiteral != nil {
	dockerfileDetails = dockerfileDetails{content: []byte(*image.DockerfileLiteral), path: "dockerfile_literal"}
} else {
        dockerfileDetails, err = readDockerfileForImage(&images[i], readFile)
 }

readDockerfileForImage is a single purpose function that reads the dockerfile, regardless if it is literal or no

Comment thread pkg/defaults/defaults.go Outdated
Comment thread pkg/defaults/defaults.go Outdated
Comment thread test/e2e/dockerfile-inputs/e2e_test.go Outdated
@Prucek
Prucek force-pushed the dockerfile-inputs branch from 70931eb to 81eef5e Compare January 19, 2026 12:22
@openshift-ci

openshift-ci Bot commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

@Prucek: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/breaking-changes 81eef5e link false /test breaking-changes

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Comment thread pkg/defaults/defaults.go
continue
}
imageSteps, image := processDetectedBaseImages(baseImages, image, dockerfileDetails)
images[i] = image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are mutating the list directly here, which can be a problem in general. In Go, it's idiomatic to construct a new list with the new data that you want to mutate and return it. In this case, this can be trivial, but this is food for thought.

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jan 20, 2026
@openshift-ci

openshift-ci Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: droslean, jmguzik, Prucek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [Prucek,droslean,jmguzik]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Prucek

Prucek commented Jan 20, 2026

Copy link
Copy Markdown
Member Author

/retest-required

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD d572709 and 2 for PR HEAD 81eef5e in total

@Prucek

Prucek commented Jan 20, 2026

Copy link
Copy Markdown
Member Author

/test e2e

@Prucek

Prucek commented Jan 20, 2026

Copy link
Copy Markdown
Member Author

/override ci/prow/integration-optional-test

@openshift-ci

openshift-ci Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@Prucek: Overrode contexts on behalf of Prucek: ci/prow/integration-optional-test

Details

In response to this:

/override ci/prow/integration-optional-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 7a2f189 into openshift:main Jan 20, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants