Skip to content

Commit c8b43a4

Browse files
raelgaclaude
andcommitted
multi_stage: make release:latest dependency conditional on config
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. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 05494d0 commit c8b43a4

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

pkg/steps/multi_stage/multi_stage.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,15 @@ func (s *multiStageTestStep) Requires() (ret []api.StepLink) {
363363
}
364364
}
365365
if s.profile != "" {
366-
needsReleasePayload = true
366+
_, hasLatestRelease := s.config.Releases[api.LatestReleaseName]
367+
if hasLatestRelease {
368+
needsReleasePayload = true
369+
}
367370
for _, env := range envForProfile {
368371
if link, ok := utils.LinkForEnv(env); ok {
369-
ret = append(ret, link)
372+
if hasLatestRelease {
373+
ret = append(ret, link)
374+
}
370375
}
371376
}
372377
}

pkg/steps/multi_stage/multi_stage_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ func TestRequires(t *testing.T) {
3232
leaseProxyServerAvailable bool
3333
req []api.StepLink
3434
}{{
35-
name: "step has a cluster profile and requires a release image, should not have ReleaseImagesLink",
35+
name: "step has a cluster profile with releases configured and requires a release image",
36+
config: api.ReleaseBuildConfiguration{
37+
InputConfiguration: api.InputConfiguration{
38+
Releases: map[string]api.UnresolvedRelease{
39+
api.LatestReleaseName: {Release: &api.Release{Channel: api.ReleaseChannelStable, Version: "4.20"}},
40+
},
41+
},
42+
},
3643
steps: api.MultiStageTestConfigurationLiteral{
3744
ClusterProfile: api.ClusterProfileAWS,
3845
Test: []api.LiteralTestStep{{From: "from-release"}},
@@ -41,6 +48,15 @@ func TestRequires(t *testing.T) {
4148
api.ReleasePayloadImageLink(api.LatestReleaseName),
4249
api.ImagesReadyLink(),
4350
},
51+
}, {
52+
name: "step has a cluster profile without releases configured, should not require release payload",
53+
steps: api.MultiStageTestConfigurationLiteral{
54+
ClusterProfile: api.ClusterProfileAWS,
55+
Test: []api.LiteralTestStep{{From: "from-release"}},
56+
},
57+
req: []api.StepLink{
58+
api.ReleaseImagesLink(api.LatestReleaseName),
59+
},
4460
}, {
4561
name: "step needs release images, should have ReleaseImagesLink",
4662
steps: api.MultiStageTestConfigurationLiteral{

0 commit comments

Comments
 (0)