Skip to content

multi_stage: make release:latest dependency conditional on config#5015

Open
raelga wants to merge 3 commits intoopenshift:mainfrom
raelga:fix/optional-release-for-cluster-profile
Open

multi_stage: make release:latest dependency conditional on config#5015
raelga wants to merge 3 commits intoopenshift:mainfrom
raelga:fix/optional-release-for-cluster-profile

Conversation

@raelga
Copy link

@raelga raelga commented Mar 15, 2026

Summary

Make the release:latest dependency in ci-operator's dependency graph conditional on whether the config actually defines a latest release, rather than unconditionally requiring it whenever cluster_profile is set.

Problem

When a CI test configures cluster_profile for cloud credentials but does not define releases.latest, ci-operator fails with:

  • could not sort nodes
  • steps are missing dependencies
  • step is missing dependencies: <&api.internalImageStreamTagLink{name:"release", tag:"latest", unsatisfiableError:""}>

This is because multiStageTestStep.Requires() unconditionally adds release:latest and IMAGE_FORMAT as dependencies whenever cluster_profile is present (multi_stage.go:365-371), assuming every profiled test needs a release payload for cluster installation.

Why this matters

Many teams use cluster_profile solely for cloud credentials — not for installing OpenShift clusters. For example, ARO-HCP periodic jobs run cleanup tasks (deleting expired Azure resources, Kusto role assignments) that need Azure credentials from the profile but never touch a release payload. Today, these configs are forced to declare a releases.latest they never use:

releases:
  latest:
    release:
      channel: stable
      version: "4.20"  # not used by any step

This adds unnecessary complexity, pulls an unused release payload (wasting resources), and is confusing for teams that don't understand why their credential-only jobs need a release image.

Changes

  • pkg/steps/multi_stage/multi_stage.go: Check config.Releases for a latest entry before adding the release:latest dependency. When no release is configured, the profile env var links (RELEASE_IMAGE_latest, IMAGE_FORMAT) are not added to the dependency graph, and needsReleasePayload is not set.
  • pkg/steps/multi_stage/multi_stage_test.go: Updated existing test case to include Releases in the config. Added new test case covering cluster_profile without releases configured.

Test plan

  • go test ./pkg/steps/multi_stage/ — all 7 TestRequires subcases pass
  • Verify with an openshift/release config that uses cluster_profile without releases (e.g., ARO-HCP cleanup periodics)
  • Verify existing jobs with both cluster_profile and releases.latest are unaffected

Copilot AI review requested due to automatic review settings March 15, 2026 20:01
@openshift-ci-robot
Copy link
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: automatic mode

@openshift-ci openshift-ci bot requested review from droslean and hector-vido March 15, 2026 20:02
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 15, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: raelga
Once this PR has been reviewed and has the lgtm label, please assign liangxia for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2cc891ff-5aff-48c9-a232-2ae99e97dcd2

📥 Commits

Reviewing files that changed from the base of the PR and between c8b43a4 and 7e776b9.

📒 Files selected for processing (2)
  • pkg/steps/multi_stage/multi_stage.go
  • pkg/steps/multi_stage/multi_stage_test.go

Walkthrough

Conditionally mark release payloads as needed for cluster profiles only when either LatestReleaseName is configured or ReleaseTagConfiguration is present; environment-based profile link generation is gated by the same checks. Tests expanded to cover multiple release/configuration scenarios and additional link expectations.

Changes

Cohort / File(s) Summary
Multi-stage logic
pkg/steps/multi_stage/multi_stage.go
Gate setting of needsReleasePayload and generation of environment-based release payload links on presence of LatestReleaseName or ReleaseTagConfiguration.
Tests — multi-stage
pkg/steps/multi_stage/multi_stage_test.go
Expanded test matrix: renamed first case, added ReleaseBuildConfiguration with LatestReleaseName, added scenarios for profiles without releases, profiles with ReleaseTagConfiguration, and additional assertions for ReleasePayloadImageLink, ImagesReadyLink, ReleaseImagesLink, InternalImageLink, and LeaseProxyServerLink expectations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Tip

You can generate walkthrough in a markdown collapsible section to save space.

Enable the reviews.collapse_walkthrough setting to generate walkthrough in a markdown collapsible section.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts ci-operator’s multi-stage dependency graph so cluster_profile tests only depend on release:latest when a latest release is actually configured, avoiding graph resolution failures for credential-only jobs.

Changes:

  • Make multiStageTestStep.Requires() add RELEASE_IMAGE_latest / IMAGE_FORMAT dependencies only when config.Releases["latest"] exists.
  • Update TestRequires to cover cluster_profile with and without releases.latest.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/steps/multi_stage/multi_stage.go Makes release:latest/IMAGE_FORMAT dependencies conditional based on presence of releases.latest.
pkg/steps/multi_stage/multi_stage_test.go Updates/adds Requires() unit tests for the new conditional dependency behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

@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 (1)
pkg/steps/multi_stage/multi_stage_test.go (1)

52-59: Add a credential-only cluster-profile test case to lock in the reported regression.

This new case still includes From: "from-release", so it validates fallback to ReleaseImagesLink, not the “cluster_profile only, no release dependency” scenario from the PR motivation.

Suggested test addition
@@
 	}, {
 		name: "step has a cluster profile without releases configured, should not require release payload",
 		steps: api.MultiStageTestConfigurationLiteral{
 			ClusterProfile: api.ClusterProfileAWS,
 			Test:           []api.LiteralTestStep{{From: "from-release"}},
 		},
 		req: []api.StepLink{
 			api.ReleaseImagesLink(api.LatestReleaseName),
 		},
+	}, {
+		name: "cluster profile only and no releases configured should not require release links",
+		steps: api.MultiStageTestConfigurationLiteral{
+			ClusterProfile: api.ClusterProfileAWS,
+		},
+		req: nil,
 	}, {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/steps/multi_stage/multi_stage_test.go` around lines 52 - 59, The new test
case currently named "step has a cluster profile without releases configured,
should not require release payload" still sets a test step From: "from-release"
and therefore asserts fallback to ReleaseImagesLink; instead add (or replace
with) a credential-only cluster-profile test where
api.MultiStageTestConfigurationLiteral has ClusterProfile: api.ClusterProfileAWS
and a Test step that does NOT include From (remove From: "from-release"), and
set req to an empty slice (no api.ReleaseImagesLink). Ensure the test uses the
same file's test harness (multi_stage_test.go) and types (api.LiteralTestStep,
api.StepLink) so it verifies the “cluster_profile only, no release dependency”
behavior.
🤖 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/multi_stage/multi_stage_test.go`:
- Around line 52-59: The new test case currently named "step has a cluster
profile without releases configured, should not require release payload" still
sets a test step From: "from-release" and therefore asserts fallback to
ReleaseImagesLink; instead add (or replace with) a credential-only
cluster-profile test where api.MultiStageTestConfigurationLiteral has
ClusterProfile: api.ClusterProfileAWS and a Test step that does NOT include From
(remove From: "from-release"), and set req to an empty slice (no
api.ReleaseImagesLink). Ensure the test uses the same file's test harness
(multi_stage_test.go) and types (api.LiteralTestStep, api.StepLink) so it
verifies the “cluster_profile only, no release dependency” behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f8710e2-6c20-480c-b084-6ef5b82b5150

📥 Commits

Reviewing files that changed from the base of the PR and between 05494d0 and c8b43a4.

📒 Files selected for processing (2)
  • pkg/steps/multi_stage/multi_stage.go
  • pkg/steps/multi_stage/multi_stage_test.go

raelga added 3 commits March 15, 2026 21:39
When a test configures cluster_profile but does not define
releases.latest, ci-operator's dependency graph unconditionally
requires release:latest, causing the job to fail. This is unnecessary
for jobs that only use the profile for cloud credentials without
installing an OpenShift cluster.

Make the release:latest dependency conditional: only require it when
the config explicitly defines a latest release in releases.
When tag_specification (ReleaseTagConfiguration) is set, ci-operator
also produces a release:latest image stream. The conditional check
must account for this in addition to explicit releases.latest entries.
Add a test case for the scenario where cluster_profile is set without
any releases or tag_specification configured, verifying that no release
dependencies are required. This covers the credential-only use case
(e.g., Azure cleanup jobs using profile just for cloud credentials).
@raelga raelga force-pushed the fix/optional-release-for-cluster-profile branch from c8b43a4 to 7e776b9 Compare March 15, 2026 20:41
@raelga raelga requested a review from Copilot March 15, 2026 20:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates ci-operator’s multi-stage test dependency calculation so cluster_profile only pulls in release:latest/IMAGE_FORMAT dependencies when the job configuration can actually produce a latest release payload (via releases.latest or tag_specification).

Changes:

  • Make multiStageTestStep.Requires() add RELEASE_IMAGE_latest/IMAGE_FORMAT links only when releases.latest or tag_specification is present.
  • Update/extend TestRequires to cover cluster_profile with: (a) releases.latest, (b) no releases, and (c) tag_specification.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/steps/multi_stage/multi_stage.go Gates needsReleasePayload and profile env-var links on presence of releases.latest or ReleaseTagConfiguration.
pkg/steps/multi_stage/multi_stage_test.go Adds coverage for cluster_profile without releases and for tag_specification behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@openshift-ci-robot
Copy link
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e

@raelga
Copy link
Author

raelga commented Mar 16, 2026

/test breaking-changes

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 16, 2026

@raelga: 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 7e776b9 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants