Skip to content

DPTP-4340: Remove direct mirroring to registry.ci.openshift.org, consolidate to single promotion step#4866

Open
deepsm007 wants to merge 2 commits intoopenshift:mainfrom
deepsm007:DPTP-4340
Open

DPTP-4340: Remove direct mirroring to registry.ci.openshift.org, consolidate to single promotion step#4866
deepsm007 wants to merge 2 commits intoopenshift:mainfrom
deepsm007:DPTP-4340

Conversation

@deepsm007
Copy link
Copy Markdown
Contributor

@deepsm007 deepsm007 commented Dec 5, 2025

Removes the direct mirroring step to registry.ci.openshift.org and consolidates promotion into a single step that handles both quay.io mirroring and tagging.

The promotion now:
(1) mirrors to quay.io/openshift/ci using oc image mirror, then
(2) tags in registry.ci.openshift.org from quay-proxy.ci.openshift.org using oc tag.
(3) Release assembly: oc adm release new now tries --from-image-stream-file (from oc get imagestream … -o yaml) and falls back to --from-image-stream if that fails (fromFile || fromStream when export succeeds; stream-only if oc get fails).

/hold
/cc @Prucek @openshift/test-platform

Summary by CodeRabbit

  • Bug Fixes

    • Quay promotions now run only when no registry override is configured; otherwise quay promotion is skipped.
    • Promotion targets no longer include the "-quay" infix, yielding shorter tag names and digest-based mirror targets when available.
  • Refactor

    • Promotion logic adjusted to better decide tag vs. mirror operations.
    • Release creation now prefers an imagestream-file approach with a safe fallback to stream-based creation.
  • Tests

    • Updated tests and fixtures to match the new naming, tagging, and mirror behaviors.

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo 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

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Dec 5, 2025
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Dec 5, 2025

@deepsm007: This pull request references DPTP-4340 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set.

Details

In response to this:

Removes the direct mirroring step to registry.ci.openshift.org and consolidates promotion into a single step that handles both quay.io mirroring and tagging.

The promotion now:
(1) mirrors to quay.io/openshift/ci using oc image mirror, then
(2) tags in registry.ci.openshift.org from quay-proxy.ci.openshift.org using oc tag.

/hold
/cc @Prucek @openshift/test-platform

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 5, 2025

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Removed -quay from quay-proxy/mirror target and imagestream tag names, made quay.io promotion conditional on CIConfig.PromotionConfiguration.RegistryOverride, adjusted tagging-vs-mirroring heuristic, and changed oc adm release new to prefer an exported imagestream file with a stream fallback. Tests and fixtures updated.

Changes

Cohort / File(s) Summary
Configuration & Defaults
pkg/defaults/defaults.go, pkg/defaults/defaults_test.go
Quay promotion step is no longer appended unconditionally; it’s added only when cfg.CIConfig.PromotionConfiguration.RegistryOverride is empty. Test expectations updated to expect only "[promotion-quay]".
API: quay proxy / mirror mapping
pkg/api/promotion.go, pkg/api/promotion_test.go
Removed -quay infix from generated imagestream tag references and mirror-map keys (now namespace/name:tag style). Tests adjusted to new keys and to handle digest vs tag mirror targets.
Promotion step generation & tagging heuristics
pkg/steps/release/promote.go, pkg/steps/release/promote_test.go
Changed decision logic for oc tag vs oc image mirror: classify images when target has api.QuayOpenShiftCIRepo+":"; otherwise tag when key contains api.ComponentFormatReplacement or source is non-digest or contains api.QCIAPPCIDomain; remaining cases are mirrored. Tests and expected mirror keys updated (removed -quay variants) and a non-digest quay case was added.
Promotion test fixtures
pkg/steps/release/testdata/...promotion_quay*.yaml
Updated fixture shell scripts to retarget oc tag destination strings by removing -quay from imagestream names; loop/retry/backoff behavior unchanged. Added a non-digest promotion fixture for tag-based source handling.
Release creation command construction & tests
pkg/steps/release/create_release.go, pkg/steps/release/create_release_test.go
Added ocAdmReleaseNewArgs(...) []string to build args; buildOcAdmReleaseNewCommand now exports imagestream YAML to a file and invokes oc adm release new --from-image-stream-file with a fallback --from-image-stream path on failure. Tests refactored to assert arg composition and presence of export/file-vs-stream fallback.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: removing direct mirroring to registry.ci.openshift.org and consolidating promotion into a single step, which aligns with the core changes across multiple files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR uses standard Go table-driven tests with static, deterministic test names; no Ginkgo-style tests found.
Test Structure And Quality ✅ Passed PR uses standard Go unit tests with testing.T, not Ginkgo. No ginkgo dependency in go.mod, no Ginkgo imports or patterns found. Tests follow Go best practices with table-driven testing.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests using MicroShift-incompatible APIs were added; all modified test files are standard Go unit tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR modifies openshift/ci-tools with changes limited to internal tool logic and standard Go unit tests, not Ginkgo e2e tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR contains only test fixtures with topology-safe kubernetes.io/arch nodeSelectors; no deployment manifests or problematic scheduling constraints that assume standard HA topology.
Ote Binary Stdout Contract ✅ Passed Pull request modifies library functions in pkg/defaults/, pkg/api/, and pkg/steps/release/ that construct shell scripts and Kubernetes Pod configurations using fmt.Sprintf(), with no stdout writes corrupting JSON output.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR contains only standard Go unit test modifications, not Ginkgo e2e tests. No new tests with IPv4 or external connectivity assumptions were added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from a team and Prucek December 5, 2025 17:00
@openshift-ci openshift-ci Bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 5, 2025
@deepsm007
Copy link
Copy Markdown
Contributor Author

/pipeline required

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test integration-optional-test

@Prucek
Copy link
Copy Markdown
Member

Prucek commented Dec 12, 2025

when we merge this only the X.Y-quay IS will stay, is that what we want? Or do we want the current X.Y IS to use QCI images https://github.com/openshift/ci-tools/blob/main/pkg/api/promotion.go#L114

@deepsm007 deepsm007 force-pushed the DPTP-4340 branch 2 times, most recently from 8c8865e to 778e4f1 Compare February 6, 2026 14:40
@deepsm007
Copy link
Copy Markdown
Contributor Author

/test images

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@deepsm007 deepsm007 force-pushed the DPTP-4340 branch 5 times, most recently from 4dd323b to 0c9127a Compare February 10, 2026 23:24
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 31, 2026
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 21, 2026
@deepsm007 deepsm007 force-pushed the DPTP-4340 branch 2 times, most recently from a88dc3b to 4c28a9a Compare April 21, 2026 02:22
@deepsm007
Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

✅ Actions performed

Reviews resumed.

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 21, 2026

@deepsm007: This pull request references DPTP-4340 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Removes the direct mirroring step to registry.ci.openshift.org and consolidates promotion into a single step that handles both quay.io mirroring and tagging.

The promotion now:
(1) mirrors to quay.io/openshift/ci using oc image mirror, then
(2) tags in registry.ci.openshift.org from quay-proxy.ci.openshift.org using oc tag.

/hold
/cc @Prucek @openshift/test-platform

Summary by CodeRabbit

  • Bug Fixes

  • Refined image promotion logic for registry override scenarios—when no override is specified, images are promoted to quay.io; when an override is configured, promotion to quay.io is skipped.

  • Refactor

  • Simplified Quay image reference naming format for improved clarity.

  • Updated image target classification criteria to more reliably distinguish between tag-based and mirror-based promotions.

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/defaults/defaults_test.go (1)

1700-1705: ⚠️ Potential issue | 🟡 Minor

Test expectation correctly updated for consolidated promotion flow.

The removal of "[promotion]" from expectedPost aligns with the code changes: the direct mirroring step is removed, leaving only "[promotion-quay]" which handles both quay.io mirroring and proxy tagging.

Minor: Add test case for RegistryOverride with promotion. The current test covers the normal promote scenario, but the RegistryOverride conditional path (lines 307–310 in defaults.go) is not tested in the main test suite. Consider adding a test case with promote: true and PromotionConfiguration.RegistryOverride set to verify no promotion steps are generated in that scenario.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/defaults/defaults_test.go` around lines 1700 - 1705, Add a new table test
case in defaults_test.go alongside the existing promote:true case that sets
promote: true and the PromotionConfiguration.RegistryOverride field to a
non-empty value; name it to indicate "RegistryOverride with promotion". In that
case set expectedSteps to the same pre-promotion steps (e.g., "[output-images]",
"[images]") but set expectedPost to an empty slice (or assert that no promotion
steps are generated) to verify the conditional path in defaults.go (the
PromotionConfiguration.RegistryOverride branch around lines ~307–310) produces
no promotion steps. Ensure the test populates the same input struct used by the
table (referencing promote and PromotionConfiguration.RegistryOverride) and
asserts equality against expectedPost and expectedSteps like the other cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@pkg/defaults/defaults_test.go`:
- Around line 1700-1705: Add a new table test case in defaults_test.go alongside
the existing promote:true case that sets promote: true and the
PromotionConfiguration.RegistryOverride field to a non-empty value; name it to
indicate "RegistryOverride with promotion". In that case set expectedSteps to
the same pre-promotion steps (e.g., "[output-images]", "[images]") but set
expectedPost to an empty slice (or assert that no promotion steps are generated)
to verify the conditional path in defaults.go (the
PromotionConfiguration.RegistryOverride branch around lines ~307–310) produces
no promotion steps. Ensure the test populates the same input struct used by the
table (referencing promote and PromotionConfiguration.RegistryOverride) and
asserts equality against expectedPost and expectedSteps like the other cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d059087d-6e01-49bd-bc62-cae27a8f234a

📥 Commits

Reviewing files that changed from the base of the PR and between 253a819 and 4c28a9a.

📒 Files selected for processing (4)
  • pkg/api/promotion.go
  • pkg/api/promotion_test.go
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
💤 Files with no reviewable changes (1)
  • pkg/defaults/defaults.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/api/promotion_test.go

@deepsm007
Copy link
Copy Markdown
Contributor Author

/test integration validate-prow

@deepsm007 deepsm007 force-pushed the DPTP-4340 branch 4 times, most recently from 0ae783a to 9a5e00d Compare April 21, 2026 12:52
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
pkg/steps/release/promote_test.go (2)

747-748: Prefer resolved destination tags in this fixture instead of ${component} templates.

These keys are template-form, while getImageMirrorTarget resolves ${component} before getPromotionPod receives the map. Using concrete tags here would better match runtime inputs and avoid masking shell-expansion edge cases.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/release/promote_test.go` around lines 747 - 748, The fixture uses
template keys "ci/ci:${component}" and "ci/${component}:c" which do not match
how getImageMirrorTarget resolves ${component} before getPromotionPod consumes
the map; update the test fixture in promote_test.go to use the concrete resolved
destination tags (replace the "${component}" template strings with the actual
component name values used in the test) so the map keys mirror runtime inputs
expected by getImageMirrorTarget and getPromotionPod, preventing
shell-expansion/template masking in the test.

1018-1018: Avoid hard-coded quay-proxy host in expected output.

Line 1018 hard-codes the host while the test logic uses api.QCIAPPCIDomain; keeping both on the same constant avoids drift.

Proposed refactor
-			expected: map[string]string{
-				"registry.ci.openshift.org/ocp/4.22:vertical-pod-autoscaler": "quay-proxy.ci.openshift.org/openshift/ci@sha256:vpa",
-			},
+			expected: map[string]string{
+				"registry.ci.openshift.org/ocp/4.22:vertical-pod-autoscaler": fmt.Sprintf("%s/openshift/ci@sha256:vpa", api.QCIAPPCIDomain),
+			},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/release/promote_test.go` at line 1018, The test hard-codes the
quay-proxy host in the expected image reference; change the expected value to
use the shared constant api.QCIAPPCIDomain instead of the literal
"quay-proxy.ci.openshift.org". Locate the map entry in promote_test.go that
currently contains "registry.ci.openshift.org/ocp/4.22:vertical-pod-autoscaler":
"quay-proxy.ci.openshift.org/openshift/ci@sha256:vpa" and construct the RHS
using api.QCIAPPCIDomain (e.g. build the string with fmt.Sprintf or
concatenation like api.QCIAPPCIDomain + "/openshift/ci@sha256:vpa") so the test
reads the host from the single source of truth.
pkg/steps/release/promote.go (1)

265-266: Stabilize tag-vs-mirror routing by removing hard-coded quay-proxy host.

Line 265 hard-codes quay-proxy.ci.openshift.org; this can silently drift from the canonical domain constant and break routing behavior.

Proposed refactor
-			if strings.Contains(k, "${component}") || strings.Contains(imageMirrorTarget[k], "quay-proxy.ci.openshift.org") {
+			if strings.Contains(k, api.ComponentFormatReplacement) || strings.Contains(imageMirrorTarget[k], api.QCIAPPCIDomain) {
				tags = append(tags, fmt.Sprintf("%s %s", imageMirrorTarget[k], k))
			} else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/release/promote.go` around lines 265 - 266, The code currently
checks strings.Contains(imageMirrorTarget[k], "quay-proxy.ci.openshift.org")
using a hard-coded host; replace that literal with the canonical quay-proxy
domain constant used in the repo (use the existing constant instead of the
string) so the condition becomes strings.Contains(imageMirrorTarget[k],
<CANONICAL_QUAY_PROXY_CONSTANT>) while keeping the existing "${component}" check
and appending to tags as before (refer to imageMirrorTarget, tags, and the loop
variable k to locate the code).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/steps/release/promote_test.go`:
- Around line 747-748: The fixture uses template keys "ci/ci:${component}" and
"ci/${component}:c" which do not match how getImageMirrorTarget resolves
${component} before getPromotionPod consumes the map; update the test fixture in
promote_test.go to use the concrete resolved destination tags (replace the
"${component}" template strings with the actual component name values used in
the test) so the map keys mirror runtime inputs expected by getImageMirrorTarget
and getPromotionPod, preventing shell-expansion/template masking in the test.
- Line 1018: The test hard-codes the quay-proxy host in the expected image
reference; change the expected value to use the shared constant
api.QCIAPPCIDomain instead of the literal "quay-proxy.ci.openshift.org". Locate
the map entry in promote_test.go that currently contains
"registry.ci.openshift.org/ocp/4.22:vertical-pod-autoscaler":
"quay-proxy.ci.openshift.org/openshift/ci@sha256:vpa" and construct the RHS
using api.QCIAPPCIDomain (e.g. build the string with fmt.Sprintf or
concatenation like api.QCIAPPCIDomain + "/openshift/ci@sha256:vpa") so the test
reads the host from the single source of truth.

In `@pkg/steps/release/promote.go`:
- Around line 265-266: The code currently checks
strings.Contains(imageMirrorTarget[k], "quay-proxy.ci.openshift.org") using a
hard-coded host; replace that literal with the canonical quay-proxy domain
constant used in the repo (use the existing constant instead of the string) so
the condition becomes strings.Contains(imageMirrorTarget[k],
<CANONICAL_QUAY_PROXY_CONSTANT>) while keeping the existing "${component}" check
and appending to tags as before (refer to imageMirrorTarget, tags, and the loop
variable k to locate the code).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f9d11c5d-94ab-400e-a0c9-917e05463dfe

📥 Commits

Reviewing files that changed from the base of the PR and between 0ae783a and 9a5e00d.

📒 Files selected for processing (10)
  • pkg/api/promotion.go
  • pkg/api/promotion_test.go
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
  • pkg/steps/release/create_release.go
  • pkg/steps/release/create_release_test.go
  • pkg/steps/release/promote.go
  • pkg/steps/release/promote_test.go
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay.yaml
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay_multiple_tags.yaml
💤 Files with no reviewable changes (1)
  • pkg/defaults/defaults.go
✅ Files skipped from review due to trivial changes (2)
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay_multiple_tags.yaml
  • pkg/api/promotion_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • pkg/defaults/defaults_test.go
  • pkg/steps/release/create_release_test.go
  • pkg/steps/release/create_release.go
  • pkg/api/promotion.go
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay.yaml

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
pkg/steps/release/create_release.go (1)

347-350: Consider preserving oc get imagestream failure context in logs.

2>/dev/null hides the reason for falling back, which can make release assembly failures harder to diagnose. Consider logging stderr (or conditionally logging on failure) before fallback.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/release/create_release.go` around lines 347 - 350, The shell
invocation that runs `oc get imagestream -n %q %q -o yaml > "${RELEASE_IS_FILE}"
2>/dev/null` suppresses stderr and loses failure context; update the logic
around that call (the block that writes to RELEASE_IS_FILE and the surrounding
fallback branches) to capture and log stderr on failure (for example redirect
stderr to a temp file or variable and call the existing logger or error handler
with its contents) before executing the fallback branch (%s or %s); ensure the
logged message includes the command, the imagestream name/namespace, and the
captured stderr so failures are diagnosable.
pkg/steps/release/promote_test.go (1)

739-765: Add one quay-promotion test with a non-digest source pullspec.

Current updated cases only validate @sha256 inputs. A non-digest source case would guard the tag/mirror classification path against regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/release/promote_test.go` around lines 739 - 765, The test suite in
promote_test.go only covers promotion inputs that include `@sha256` digests; add a
new test case (e.g., name: "promotion-quay-non-digest" / stepName:
"promotion-quay") alongside the existing cases to exercise a non-digest source
pullspec so the tag/mirror classification path is validated. In that new case
populate imageMirror with at least one mapping where the source pullspec is a
tag (no `@sha256`), for example mapping "quay.io/openshift/ci:ci_a_latest" or
"ci/${component}:c" to an expected mirror, and keep nodeArchitectures/namespace
consistent with the other quay tests so the existing test runner (the
table-driven test around these cases) will assert the classification behavior.
Ensure the new case follows the same structure and assertions as
"promotion-quay" / "promotion-quay-multiple-tags".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/steps/release/promote.go`:
- Around line 265-269: The routing logic misclassifies non-digest sources
because it only checks for api.QCIAPPCIDomain; change the decision to rely on
whether the target pullspec is a digest. In the block around the condition that
uses k, imageMirrorTarget, api.ComponentFormatReplacement and
api.QCIAPPCIDomain, treat an entry as a tag (append to tags) when k contains
api.ComponentFormatReplacement OR the target pullspec does NOT contain
"@sha256:"; otherwise treat it as an image to mirror (append to images). This
ensures non-digest sources are handled as tags and only true digest pullspecs
become mirror entries.

---

Nitpick comments:
In `@pkg/steps/release/create_release.go`:
- Around line 347-350: The shell invocation that runs `oc get imagestream -n %q
%q -o yaml > "${RELEASE_IS_FILE}" 2>/dev/null` suppresses stderr and loses
failure context; update the logic around that call (the block that writes to
RELEASE_IS_FILE and the surrounding fallback branches) to capture and log stderr
on failure (for example redirect stderr to a temp file or variable and call the
existing logger or error handler with its contents) before executing the
fallback branch (%s or %s); ensure the logged message includes the command, the
imagestream name/namespace, and the captured stderr so failures are diagnosable.

In `@pkg/steps/release/promote_test.go`:
- Around line 739-765: The test suite in promote_test.go only covers promotion
inputs that include `@sha256` digests; add a new test case (e.g., name:
"promotion-quay-non-digest" / stepName: "promotion-quay") alongside the existing
cases to exercise a non-digest source pullspec so the tag/mirror classification
path is validated. In that new case populate imageMirror with at least one
mapping where the source pullspec is a tag (no `@sha256`), for example mapping
"quay.io/openshift/ci:ci_a_latest" or "ci/${component}:c" to an expected mirror,
and keep nodeArchitectures/namespace consistent with the other quay tests so the
existing test runner (the table-driven test around these cases) will assert the
classification behavior. Ensure the new case follows the same structure and
assertions as "promotion-quay" / "promotion-quay-multiple-tags".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 70813248-7bd7-4270-b32a-95cd58c21847

📥 Commits

Reviewing files that changed from the base of the PR and between 9a5e00d and 4457cd9.

📒 Files selected for processing (10)
  • pkg/api/promotion.go
  • pkg/api/promotion_test.go
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
  • pkg/steps/release/create_release.go
  • pkg/steps/release/create_release_test.go
  • pkg/steps/release/promote.go
  • pkg/steps/release/promote_test.go
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay.yaml
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay_multiple_tags.yaml
💤 Files with no reviewable changes (1)
  • pkg/defaults/defaults.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/defaults/defaults_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • pkg/api/promotion_test.go
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay_multiple_tags.yaml
  • pkg/steps/release/create_release_test.go

Comment thread pkg/steps/release/promote.go Outdated
FromConfig no longer registers the legacy promotion step when promoting; update TestFromConfig expectedPost to match.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
pkg/steps/release/promote.go (1)

265-273: ⚠️ Potential issue | 🟠 Major

Route host-qualified destinations to oc image mirror first.

Line [269] can still classify a host-qualified destination into oc tag when src is non-digest. That can break promotion because oc tag expects imagestream destinations, not full pullspec-style targets.

Proposed fix
+func hasRegistryHost(ref string) bool {
+	first := strings.SplitN(ref, "/", 2)[0]
+	return strings.Contains(first, ".") || strings.Contains(first, ":") || first == "localhost"
+}
+
 func getPromotionPod(imageMirrorTarget map[string]string, timeStr string, namespace string, name string, cliVersion string, nodeArchitectures []string) *coreapi.Pod {
@@
-			if strings.HasPrefix(k, api.QuayOpenShiftCIRepo+":") {
-				// Images promoted into quay.io/openshift/ci always use oc image mirror (tag or digest sources).
+			if hasRegistryHost(k) {
+				// Host-qualified destinations must use oc image mirror.
 				images = append(images, fmt.Sprintf("%s=%s", src, k))
 			} else if strings.Contains(k, api.ComponentFormatReplacement) || !strings.Contains(src, "@sha256:") || strings.Contains(src, api.QCIAPPCIDomain) {
 				// Cluster ImageStream tags: oc tag for non-digest sources, quay-proxy imports, or ${component} templates.
 				tags = append(tags, fmt.Sprintf("%s %s", src, k))
 			} else {
 				images = append(images, fmt.Sprintf("%s=%s", src, k))
 			}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/release/promote.go` around lines 265 - 273, The current branch can
misclassify host-qualified destinations (full pullspecs) as imagestream tags;
update the logic in promote.go where imageMirrorTarget, k, src, images, and tags
are handled so that any host-qualified destination (k that looks like a pullspec
/ contains a registry host component, e.g. contains a '/' and a domain component
like '.' or ':') is routed to oc image mirror first (append to images) before
considering the oc tag branch; implement this by checking the host-qualified
predicate on k first and appending fmt.Sprintf("%s=%s", src, k) to images,
otherwise continue with the existing ComponentFormatReplacement / digest /
QCIAPPCIDomain checks to decide tags vs images.
🧹 Nitpick comments (1)
pkg/steps/release/promote_test.go (1)

769-781: Add one regression case for non-digest source + host-qualified destination.

Nice addition for non-digest handling. Please also add a case where destination is host-qualified (e.g., registry.ci.openshift.org/...) with a tag-based source, to guard against accidental oc tag routing.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/release/promote_test.go` around lines 769 - 781, Add a regression
test case alongside the existing "promotion-quay-non-digest" entry to exercise a
tag-based source mapped to a host-qualified destination (to prevent accidental
oc tag routing). Create a new table entry with a unique name (e.g.,
"promotion-host-qualified-non-digest"), same stepName "promotion-quay",
nodeArchitectures and namespace as needed, and an imageMirror map where a tag
source like "quay.io/openshift/ci:ci_a_latest" or "ci/${component}:c" maps to a
host-qualified destination such as
"registry.ci.openshift.org/ci-op-xxxx/pipeline:promoted-tag" (not a `@sha256`
digest). Place this new case near the existing test cases so it runs with the
promote_test.go table-driven tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@pkg/steps/release/promote.go`:
- Around line 265-273: The current branch can misclassify host-qualified
destinations (full pullspecs) as imagestream tags; update the logic in
promote.go where imageMirrorTarget, k, src, images, and tags are handled so that
any host-qualified destination (k that looks like a pullspec / contains a
registry host component, e.g. contains a '/' and a domain component like '.' or
':') is routed to oc image mirror first (append to images) before considering
the oc tag branch; implement this by checking the host-qualified predicate on k
first and appending fmt.Sprintf("%s=%s", src, k) to images, otherwise continue
with the existing ComponentFormatReplacement / digest / QCIAPPCIDomain checks to
decide tags vs images.

---

Nitpick comments:
In `@pkg/steps/release/promote_test.go`:
- Around line 769-781: Add a regression test case alongside the existing
"promotion-quay-non-digest" entry to exercise a tag-based source mapped to a
host-qualified destination (to prevent accidental oc tag routing). Create a new
table entry with a unique name (e.g., "promotion-host-qualified-non-digest"),
same stepName "promotion-quay", nodeArchitectures and namespace as needed, and
an imageMirror map where a tag source like "quay.io/openshift/ci:ci_a_latest" or
"ci/${component}:c" maps to a host-qualified destination such as
"registry.ci.openshift.org/ci-op-xxxx/pipeline:promoted-tag" (not a `@sha256`
digest). Place this new case near the existing test cases so it runs with the
promote_test.go table-driven tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 438aa299-7e87-4357-87eb-a0df8990b004

📥 Commits

Reviewing files that changed from the base of the PR and between 4457cd9 and a0ee742.

📒 Files selected for processing (11)
  • pkg/api/promotion.go
  • pkg/api/promotion_test.go
  • pkg/defaults/defaults.go
  • pkg/defaults/defaults_test.go
  • pkg/steps/release/create_release.go
  • pkg/steps/release/create_release_test.go
  • pkg/steps/release/promote.go
  • pkg/steps/release/promote_test.go
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay.yaml
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay_multiple_tags.yaml
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay_non_digest.yaml
💤 Files with no reviewable changes (1)
  • pkg/defaults/defaults.go
✅ Files skipped from review due to trivial changes (4)
  • pkg/api/promotion.go
  • pkg/defaults/defaults_test.go
  • pkg/api/promotion_test.go
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay_non_digest.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/steps/release/create_release_test.go
  • pkg/steps/release/testdata/zz_fixture_TestGetPromotionPod_promotion_quay.yaml

@deepsm007
Copy link
Copy Markdown
Contributor Author

/test images e2e

Comment on lines +107 to +126
func TestBuildOcAdmReleaseNewCommand(t *testing.T) {
cfg := &api.ReleaseTagConfiguration{Name: "4.15"}
got := buildOcAdmReleaseNewCommand(cfg, "ns", "stable", "cvo", "dest:tag", "ver")
var testCases = []struct {
name string
want string
}{
{"exports imagestream to file", `oc get imagestream -n "ns" "stable"`},
{"captures oc get stderr", "GET_ERR"},
{"logs stderr on get failure", "failed, stderr:"},
{"uses from-image-stream-file", "--from-image-stream-file=${RELEASE_IS_FILE}"},
{"file then stream with or", " || "},
{"from-image-stream fallback", "--from-image-stream stable"},
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
if !strings.Contains(got, testCase.want) {
t.Errorf("%s: got does not contain %q:\n%s", testCase.name, testCase.want, got)
}
})
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.

I don't understand what this is testing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it ensures the big generated shell string still has the right pieces after refactors, instead of testing behavior by running a shell in Go.

Comment thread pkg/steps/release/create_release.go Outdated
Comment on lines +342 to +355
func buildOcAdmReleaseNewCommand(config *api.ReleaseTagConfiguration, namespace, streamName, cvo, destination, version string) string {
fromFile := strings.Join(ocAdmReleaseNewArgs(config, namespace, streamName, cvo, destination, version, "${RELEASE_IS_FILE}"), " ")
fromStream := strings.Join(ocAdmReleaseNewArgs(config, namespace, streamName, cvo, destination, version, ""), " ")
return fmt.Sprintf(`(
RELEASE_IS_FILE="${ARTIFACT_DIR:-/tmp}/release-input-is.yaml"
GET_ERR="${ARTIFACT_DIR:-/tmp}/release-is-get.err"
if oc get imagestream -n %q %q -o yaml > "${RELEASE_IS_FILE}" 2>"${GET_ERR}"; then
%s || %s
else
echo "$(date -Is) oc get imagestream -n %q %q -o yaml failed, stderr:" >&2
cat "${GET_ERR}" >&2
%s
fi
)`, namespace, streamName, fromFile, fromStream, namespace, streamName, fromStream)
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.

Could we do something with this? I don't like the logic in a shell script, but I guess not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Stuck with shell in the string for this design; we can still make the Go side clearer, safer, and better tested. If you want, I can do a small refactor in-repo: extract the template + add a one-shot golden expected string for the default args (no behavior change)

Comment on lines +265 to +273
src := imageMirrorTarget[k]
if strings.HasPrefix(k, api.QuayOpenShiftCIRepo+":") {
// Images promoted into quay.io/openshift/ci always use oc image mirror (tag or digest sources).
images = append(images, fmt.Sprintf("%s=%s", src, k))
} else if strings.Contains(k, api.ComponentFormatReplacement) || !strings.Contains(src, "@sha256:") || strings.Contains(src, api.QCIAPPCIDomain) {
// Cluster ImageStream tags: oc tag for non-digest sources, quay-proxy imports, or ${component} templates.
tags = append(tags, fmt.Sprintf("%s %s", src, k))
} else {
// Default to mirroring for quay.io targets and other registries
images = append(images, fmt.Sprintf("%s=%s", imageMirrorTarget[k], k))
images = append(images, fmt.Sprintf("%s=%s", src, k))
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.

Could you explain this to me in an example, maybe?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Destinations under quay.io/openshift/ci always use oc image mirror (tag or digest sources). All other destinations use oc tag when the key has ${component}, the source has no @sha256:, or the source is quay-proxy; otherwise they use oc image mirror (e.g. pipeline digest → registry.ci / similar). This fixes mis-routing that came from classifying only on quay-proxy instead of destination + digest/pull spec.

@Prucek
Copy link
Copy Markdown
Member

Prucek commented Apr 22, 2026

/retest-required

@Prucek
Copy link
Copy Markdown
Member

Prucek commented Apr 22, 2026

/skip

@deepsm007
Copy link
Copy Markdown
Contributor Author

when we merge this only the X.Y-quay IS will stay, is that what we want? Or do we want the current X.Y IS to use QCI images https://github.com/openshift/ci-tools/blob/main/pkg/api/promotion.go#L114

We only want 4.x imagestream and the mechanism which was used to tag from quay-proxy will be used on 4.X.Y imagestream. The $.X.Y-quay was created for testing.

@Prucek
Copy link
Copy Markdown
Member

Prucek commented Apr 22, 2026

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 22, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 22, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepsm007, 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:

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

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 22, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 22, 2026

New changes are detected. LGTM label has been removed.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 22, 2026

@deepsm007: The following tests 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 a8c137b link false /test breaking-changes
ci/prow/images a8c137b link true /test images

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.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants