diff --git a/config/serverless-operator.yaml b/config/serverless-operator.yaml index 92a7f395..53ee3c0b 100644 --- a/config/serverless-operator.yaml +++ b/config/serverless-operator.yaml @@ -29,8 +29,15 @@ config: enabled: true excludes: - .*ocp-4.22-lp-interop.* + skipE2EMatches: + - "^kitchensink-upgrade$" useClusterPool: true version: "4.21" + - includeE2EMatches: + - "^kitchensink-upgrade$" + onDemand: true + skipPromotion: true + version: "4.20" - onDemand: true version: "4.16" promotion: {} diff --git a/pkg/prowgen/prowgen_config.go b/pkg/prowgen/prowgen_config.go index 0b582559..d9bb48e0 100644 --- a/pkg/prowgen/prowgen_config.go +++ b/pkg/prowgen/prowgen_config.go @@ -123,6 +123,12 @@ type OpenShift struct { OnDemand bool `json:"onDemand,omitempty" yaml:"onDemand,omitempty"` CustomConfigs *CustomConfigsEnablement `json:"customConfigs,omitempty" yaml:"customConfigs,omitempty"` CandidateRelease bool `json:"candidateRelease,omitempty" yaml:"candidateRelease,omitempty"` + // SkipPromotion excludes this OpenShift version from promotion indexing. + SkipPromotion bool `json:"skipPromotion,omitempty" yaml:"skipPromotion,omitempty"` + // SkipE2EMatches excludes e2e tests (by exact match on E2ETest.Match) from this OpenShift version. + SkipE2EMatches []string `json:"skipE2EMatches,omitempty" yaml:"skipE2EMatches,omitempty"` + // IncludeE2EMatches, if non-empty, limits this OpenShift version to only the listed e2e tests (by exact match on E2ETest.Match). + IncludeE2EMatches []string `json:"includeE2EMatches,omitempty" yaml:"includeE2EMatches,omitempty"` } type CustomConfigsEnablement struct { @@ -187,7 +193,8 @@ func NewGenerateConfigs(ctx context.Context, r Repository, cc CommonConfig, opts openshiftVersions := branch.OpenShiftVersions - for i, ov := range openshiftVersions { + promotionIndex := 0 + for _, ov := range openshiftVersions { log.Println(r.RepositoryDirectory(), "Generating config", branchName, "OpenShiftVersion", ov) variant := strings.ReplaceAll(ov.Version, ".", "") @@ -261,10 +268,13 @@ func NewGenerateConfigs(ctx context.Context, r Repository, cc CommonConfig, opts options := make([]ReleaseBuildConfigurationOption, 0, len(opts)) copy(options, opts) - if i == 0 { - options = append(options, withNamePromotion(r, branch, branchName)) - } else if i == 1 { - options = append(options, withTagPromotion(r, branch, branchName)) + if !ov.SkipPromotion { + if promotionIndex == 0 { + options = append(options, withNamePromotion(r, branch, branchName)) + } else if promotionIndex == 1 { + options = append(options, withTagPromotion(r, branch, branchName)) + } + promotionIndex++ } fromImage := srcImage diff --git a/pkg/prowgen/prowgen_tests.go b/pkg/prowgen/prowgen_tests.go index 71c68dbb..100065e7 100644 --- a/pkg/prowgen/prowgen_tests.go +++ b/pkg/prowgen/prowgen_tests.go @@ -50,7 +50,8 @@ var makefileTargetPattern = regexp.MustCompile("^(\\S+):\\s*(.*)$") func DiscoverTests(r Repository, openShift OpenShift, sourceImageName string, skipE2ETestMatch []string, random *rand.Rand) ReleaseBuildConfigurationOption { return func(cfg *cioperatorapi.ReleaseBuildConfiguration) error { - tests, err := discoverE2ETests(r, skipE2ETestMatch) + combinedSkip := append(append([]string(nil), skipE2ETestMatch...), openShift.SkipE2EMatches...) + tests, err := discoverE2ETests(r, combinedSkip, openShift.IncludeE2EMatches) if err != nil { return err } @@ -316,7 +317,7 @@ func (t *Test) HexSha() string { return hex.EncodeToString(h.Sum(nil))[:shaLength] } -func discoverE2ETests(r Repository, skipE2ETestMatch []string) ([]Test, error) { +func discoverE2ETests(r Repository, skipE2ETestMatch []string, includeE2ETestMatch []string) ([]Test, error) { makefilePath := filepath.Join(r.RepositoryDirectory(), "Makefile") if _, err := os.Stat(makefilePath); err != nil && os.IsNotExist(err) { return nil, nil @@ -343,6 +344,9 @@ func discoverE2ETests(r Repository, skipE2ETestMatch []string) ([]Test, error) { if slices.Contains(skipE2ETestMatch, e2e.Match) { continue } + if len(includeE2ETestMatch) > 0 && !slices.Contains(includeE2ETestMatch, e2e.Match) { + continue + } if err := createTest(r, target, e2e, &targets, commands); err != nil { return nil, err }