diff --git a/pkg/steps/multi_stage/multi_stage.go b/pkg/steps/multi_stage/multi_stage.go index b27e22a94a..9cb7861a51 100644 --- a/pkg/steps/multi_stage/multi_stage.go +++ b/pkg/steps/multi_stage/multi_stage.go @@ -363,10 +363,16 @@ func (s *multiStageTestStep) Requires() (ret []api.StepLink) { } } if s.profile != "" { - needsReleasePayload = true + _, hasLatestRelease := s.config.Releases[api.LatestReleaseName] + hasReleaseTagConfig := s.config.ReleaseTagConfiguration != nil + if hasLatestRelease || hasReleaseTagConfig { + needsReleasePayload = true + } for _, env := range envForProfile { if link, ok := utils.LinkForEnv(env); ok { - ret = append(ret, link) + if hasLatestRelease || hasReleaseTagConfig { + ret = append(ret, link) + } } } } diff --git a/pkg/steps/multi_stage/multi_stage_test.go b/pkg/steps/multi_stage/multi_stage_test.go index ff162d26df..95e0b80a0e 100644 --- a/pkg/steps/multi_stage/multi_stage_test.go +++ b/pkg/steps/multi_stage/multi_stage_test.go @@ -32,11 +32,50 @@ func TestRequires(t *testing.T) { leaseProxyServerAvailable bool req []api.StepLink }{{ - name: "step has a cluster profile and requires a release image, should not have ReleaseImagesLink", + name: "step has a cluster profile with releases configured and requires a release image", + config: api.ReleaseBuildConfiguration{ + InputConfiguration: api.InputConfiguration{ + Releases: map[string]api.UnresolvedRelease{ + api.LatestReleaseName: {Release: &api.Release{Channel: api.ReleaseChannelStable, Version: "4.20"}}, + }, + }, + }, + steps: api.MultiStageTestConfigurationLiteral{ + ClusterProfile: api.ClusterProfileAWS, + Test: []api.LiteralTestStep{{From: "from-release"}}, + }, + req: []api.StepLink{ + api.ReleasePayloadImageLink(api.LatestReleaseName), + api.ImagesReadyLink(), + }, + }, { + 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 without releases should not require any release links", + steps: api.MultiStageTestConfigurationLiteral{ + ClusterProfile: api.ClusterProfileAWS, + }, + req: nil, + }, { + name: "cluster profile with tag_specification should require release payload", + config: api.ReleaseBuildConfiguration{ + InputConfiguration: api.InputConfiguration{ + ReleaseTagConfiguration: &api.ReleaseTagConfiguration{ + Namespace: "ocp", + Name: "4.20", + }, + }, + }, + steps: api.MultiStageTestConfigurationLiteral{ + ClusterProfile: api.ClusterProfileAWS, + }, req: []api.StepLink{ api.ReleasePayloadImageLink(api.LatestReleaseName), api.ImagesReadyLink(),