diff --git a/cmd/check-gh-automation/main.go b/cmd/check-gh-automation/main.go index 7ff4c2d430b..3d2c01649af 100644 --- a/cmd/check-gh-automation/main.go +++ b/cmd/check-gh-automation/main.go @@ -369,9 +369,6 @@ func gatherModifiedRepos(releaseRepoPath string, logger *logrus.Entry) []string for _, c := range configs { path := strings.TrimPrefix(c, config.CiopConfigInRepoPath+"/") split := strings.Split(path, "/") - if split[1] == ".config.prowgen" { - continue - } if split[1] == "OWNERS" { continue } diff --git a/cmd/ci-operator-prowgen/main.go b/cmd/ci-operator-prowgen/main.go index eea7e38fe91..0a20f8ade24 100644 --- a/cmd/ci-operator-prowgen/main.go +++ b/cmd/ci-operator-prowgen/main.go @@ -102,9 +102,9 @@ func (o *options) process() error { // generateJobsToDir generates prow job configuration into the dir provided by // consuming ci-operator configuration. -func (o *options) generateJobsToDir(subDir string, prowConfig map[string]*config.Prowgen) error { +func (o *options) generateJobsToDir(subDir string) error { generated := map[string]*prowconfig.JobConfig{} - genJobsFunc := generateJobs(o.resolver, prowConfig, generated) + genJobsFunc := generateJobs(o.resolver, generated) if err := o.OperateOnCIOperatorConfigDir(filepath.Join(o.fromDir, subDir), genJobsFunc); err != nil { return fmt.Errorf("failed to generate jobs: %w", err) } @@ -120,37 +120,9 @@ func (o *options) generateJobsToDir(subDir string, prowConfig map[string]*config return writeToDir(o.toDir, generated) } -func generateJobs(resolver registry.Resolver, cache map[string]*config.Prowgen, output map[string]*prowconfig.JobConfig) func(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *config.Info) error { +func generateJobs(resolver registry.Resolver, output map[string]*prowconfig.JobConfig) func(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *config.Info) error { return func(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *config.Info) error { orgRepo := fmt.Sprintf("%s/%s", info.Org, info.Repo) - pInfo := &prowgen.ProwgenInfo{Metadata: info.Metadata, Config: config.Prowgen{Private: false, Expose: false}} - var ok bool - var err error - var orgConfig, repoConfig *config.Prowgen - - if orgConfig, ok = cache[info.Org]; !ok { - if cache[info.Org], err = config.LoadProwgenConfig(info.OrgPath); err != nil { - return err - } - orgConfig = cache[info.Org] - } - - if repoConfig, ok = cache[orgRepo]; !ok { - if cache[orgRepo], err = config.LoadProwgenConfig(info.RepoPath); err != nil { - return err - } - repoConfig = cache[orgRepo] - } - - switch { - case orgConfig != nil: - pInfo.Config = *orgConfig - if repoConfig != nil { - pInfo.Config.MergeDefaults(repoConfig) - } - case repoConfig != nil: - pInfo.Config = *repoConfig - } if resolver != nil { resolved, err := registry.ResolveConfig(resolver, *configSpec) if err != nil { @@ -158,7 +130,7 @@ func generateJobs(resolver registry.Resolver, cache map[string]*config.Prowgen, } configSpec = &resolved } - generated, err := prowgen.GenerateJobs(configSpec, pInfo) + generated, err := prowgen.GenerateJobs(configSpec, &info.Metadata) if err != nil { return err } @@ -227,10 +199,9 @@ func main() { args = append(args, "") } logger := logrus.WithFields(logrus.Fields{"target": opt.toDir, "source": opt.fromDir}) - config := map[string]*config.Prowgen{} for _, subDir := range args { logger = logger.WithFields(logrus.Fields{"subdir": subDir}) - if err := opt.generateJobsToDir(subDir, config); err != nil { + if err := opt.generateJobsToDir(subDir); err != nil { logger.WithError(err).Fatal("Failed to generate jobs") } } diff --git a/cmd/ci-operator-prowgen/main_test.go b/cmd/ci-operator-prowgen/main_test.go index 4934c280ffc..b34a295002e 100644 --- a/cmd/ci-operator-prowgen/main_test.go +++ b/cmd/ci-operator-prowgen/main_test.go @@ -7,7 +7,6 @@ import ( "strings" "testing" - "github.com/openshift/ci-tools/pkg/config" "github.com/openshift/ci-tools/pkg/testhelper" ) @@ -293,7 +292,7 @@ tests: } o := options{fromDir: fullConfigPath, toDir: baseProwConfigDir} - if err := o.generateJobsToDir("", map[string]*config.Prowgen{}); err != nil { + if err := o.generateJobsToDir(""); err != nil { t.Fatalf("Unexpected error generating jobs from config: %v", err) } diff --git a/cmd/multi-pr-prow-plugin/server.go b/cmd/multi-pr-prow-plugin/server.go index 852bb7b3c0d..a90029efba6 100644 --- a/cmd/multi-pr-prow-plugin/server.go +++ b/cmd/multi-pr-prow-plugin/server.go @@ -358,8 +358,7 @@ func (s *server) generateProwJob(jr jobRun) (*prowv1.ProwJob, error) { test.Timeout.Duration = defaultMultiRefJobTimeout } - fakeProwgenInfo := &prowgen.ProwgenInfo{Metadata: testJobMetadata} - jobBaseGen := prowgen.NewProwJobBaseBuilderForTest(ciopConfig, fakeProwgenInfo, prowgen.NewCiOperatorPodSpecGenerator(), test) + jobBaseGen := prowgen.NewProwJobBaseBuilderForTest(ciopConfig, &testJobMetadata, prowgen.NewCiOperatorPodSpecGenerator(), test) jobBaseGen.PodSpec.Add(prowgen.InjectTestFrom(&jr.JobMetadata)) jobBaseGen.PodSpec.Add(prowgen.CustomHashInput(jobName)) @@ -378,7 +377,7 @@ func (s *server) generateProwJob(jr jobRun) (*prowv1.ProwJob, error) { } jobBaseGen.Cluster(api.Cluster(cluster)) - periodic = prowgen.GeneratePeriodicForTest(jobBaseGen, fakeProwgenInfo) + periodic = prowgen.GeneratePeriodicForTest(jobBaseGen, &testJobMetadata) break } if periodic == nil { diff --git a/pkg/config/load.go b/pkg/config/load.go index d2107e3bef1..2ebf79ccbdc 100644 --- a/pkg/config/load.go +++ b/pkg/config/load.go @@ -6,198 +6,17 @@ import ( "os" "path" "path/filepath" - "regexp" - "slices" "strings" "github.com/ghodss/yaml" "github.com/sirupsen/logrus" - utilerrors "k8s.io/apimachinery/pkg/util/errors" - "k8s.io/apimachinery/pkg/util/sets" - prowv1 "sigs.k8s.io/prow/pkg/apis/prowjobs/v1" - cioperatorapi "github.com/openshift/ci-tools/pkg/api" "github.com/openshift/ci-tools/pkg/util" "github.com/openshift/ci-tools/pkg/util/gzip" "github.com/openshift/ci-tools/pkg/validation" ) -// ProwgenFile is the name of prowgen's configuration file. -var ProwgenFile = ".config.prowgen" - -// Prowgen holds the information of the prowgen's configuration file. -type Prowgen struct { - // Private indicates that generated jobs should be marked as hidden - // from display in deck and that they should mount appropriate git credentials - // to clone the repository under test. - Private bool `json:"private,omitempty"` - // Expose declares that jobs should not be hidden from view in deck if they - // are private. - // This field has no effect if private is not set. - Expose bool `json:"expose,omitempty"` - // Rehearsals declares any disabled rehearsals for jobs - Rehearsals Rehearsals `json:"rehearsals,omitempty"` - // SlackReporterConfigs defines all desired slack reporter info for included jobs - SlackReporterConfigs []SlackReporterConfig `json:"slack_reporter,omitempty"` - // SkipOperatorPresubmits allow users to skip the presubmit generation for that specific variant - SkipOperatorPresubmits []SkipOperatorPresubmits `json:"skip_operator_presubmits,omitempty"` - // EnableSecretsStoreCSIDriver indicates that jobs should use the new CSI Secrets Store - // mechanism to handle multi-stage credentials secrets. - EnableSecretsStoreCSIDriver bool `json:"enable_secrets_store_csi_driver,omitempty"` -} - -// SlackReporterConfig groups test names to a channel to report; mimicking Prow's version, with some unnecessary fields removed -type SlackReporterConfig struct { - Channel string `json:"channel,omitempty"` - JobStatesToReport []prowv1.ProwJobState `json:"job_states_to_report,omitempty"` - ReportTemplate string `json:"report_template,omitempty"` - // JobNames matches against test names (e.g., "unit", "e2e") not full Prow job names. - // This is intentional for backward compatibility - existing configs use test names here. - JobNames []string `json:"job_names,omitempty"` - // JobNamePatterns are regex patterns that match against test names (e.g., ".*-e2e$"). - // Like JobNames, these match test names, not full Prow job names. - JobNamePatterns []string `json:"job_name_patterns,omitempty"` - // ExcludedVariants is a list of variants to skip (e.g., ["hypershift", "okd"]) - ExcludedVariants []string `json:"excluded_variants,omitempty"` - // ExcludedJobPatterns are regex patterns that match against FULL Prow job names - // (e.g., "^pull-.*-skip$" or "^periodic-"). This lets you exclude specific job types - // or use prefixes that only exist in the full job name, not the test name. - ExcludedJobPatterns []string `json:"excluded_job_patterns,omitempty"` -} - -type SkipOperatorPresubmits struct { - Branch string `json:"branch,omitempty"` - Variant string `json:"variant,omitempty"` -} - -// GetSlackReporterConfigForJobName checks against full job names, allowing excluded_job_patterns -// to work with prefixes like "pull-", "periodic-", etc. -func (p *Prowgen) GetSlackReporterConfigForJobName(fullJobName, testName, variant string) *SlackReporterConfig { -nextSlackReporterConfig: - for _, s := range p.SlackReporterConfigs { - if slices.Contains(s.ExcludedVariants, variant) { - continue - } - - // Check if job is excluded by pattern (using full job name) - for _, excludePattern := range s.ExcludedJobPatterns { - if matched, err := regexp.MatchString(excludePattern, fullJobName); err == nil && matched { - continue nextSlackReporterConfig - } - } - - // Check exact job name matches first (against test name for backward compatibility) - if slices.Contains(s.JobNames, testName) { - return &s - } - - // Check regex pattern matches (against test name for backward compatibility) - for _, pattern := range s.JobNamePatterns { - if matched, err := regexp.MatchString(pattern, testName); err == nil && matched { - return &s - } - } - } - return nil -} - -func (p *Prowgen) MergeDefaults(defaults *Prowgen) { - if defaults.Private { - p.Private = true - } - if defaults.Expose { - p.Expose = true - } - if defaults.EnableSecretsStoreCSIDriver { - p.EnableSecretsStoreCSIDriver = true - } - if defaults.Rehearsals.DisableAll { - p.Rehearsals.DisableAll = true - } - p.Rehearsals.DisabledRehearsals = append(p.Rehearsals.DisabledRehearsals, defaults.Rehearsals.DisabledRehearsals...) -} - -func LoadProwgenConfig(folder string) (*Prowgen, error) { - var pConfig *Prowgen - path := filepath.Join(folder, ProwgenFile) - b, err := os.ReadFile(path) - if err != nil && !os.IsNotExist(err) { - return nil, fmt.Errorf("prowgen config found in path %s but couldn't read the file: %w", path, err) - } - - if err == nil { - if err := yaml.Unmarshal(b, &pConfig); err != nil { - return nil, fmt.Errorf("prowgen config found in path %sbut couldn't unmarshal it: %w", path, err) - } - } - - if pConfig != nil { - if err := validateProwgenConfig(pConfig); err != nil { - return nil, fmt.Errorf("prowgen config found in path %s, but it is invalid: %w", path, err) - } - } - - return pConfig, nil -} - -func validateProwgenConfig(pConfig *Prowgen) error { - var errs []error - if len(pConfig.SlackReporterConfigs) > 1 { // There is no reason to validate if we only have one slack_reporter_config - jobsSeen := sets.NewString() - patternsSeen := sets.NewString() - - for _, sc := range pConfig.SlackReporterConfigs { - // Validate exact job names - for _, job := range sc.JobNames { - if jobsSeen.Has(job) { - errs = append(errs, fmt.Errorf("job: %s exists in multiple slack_reporter_configs, it should only be in one", job)) - continue - } - jobsSeen.Insert(job) - } - - // Validate regex patterns - for _, pattern := range sc.JobNamePatterns { - // Check if regex pattern is valid - if _, err := regexp.Compile(pattern); err != nil { - errs = append(errs, fmt.Errorf("invalid regex pattern: %s, error: %w", pattern, err)) - continue - } - - // Check for duplicate patterns - if patternsSeen.Has(pattern) { - errs = append(errs, fmt.Errorf("regex pattern: %s exists in multiple slack_reporter_configs, it should only be in one", pattern)) - continue - } - patternsSeen.Insert(pattern) - } - - // Validate excluded job patterns - for _, pattern := range sc.ExcludedJobPatterns { - // Check if regex pattern is valid - if _, err := regexp.Compile(pattern); err != nil { - errs = append(errs, fmt.Errorf("invalid excluded job pattern: %s, error: %w", pattern, err)) - continue - } - - // Note: We don't check for duplicates in excluded patterns as it's reasonable - // to have the same exclusion in multiple configs - } - } - } - return utilerrors.NewAggregate(errs) -} - -type Rehearsals struct { - // DisableAll indicates that all jobs will not have their "can-be-rehearsed" label set - // and therefore will not be picked up for rehearsals. - DisableAll bool `json:"disable_all,omitempty"` - // DisabledRehearsals contains a list of jobs that will not have their "can-be-rehearsed" label set - // and therefore will not be picked up for rehearsals. - DisabledRehearsals []string `json:"disabled_rehearsals,omitempty"` -} - func readCiOperatorConfig(configFilePath string, info Info) (*cioperatorapi.ReleaseBuildConfiguration, error) { data, err := gzip.ReadFileMaybeGZIP(configFilePath) if err != nil { @@ -496,12 +315,3 @@ func LoadByOrgRepo(path string) (ByOrgRepo, error) { } return config, nil } - -func (p *Prowgen) SkipPresubmits(branch string, variant string) bool { - for _, skip := range p.SkipOperatorPresubmits { - if skip.Branch == branch && skip.Variant == variant { - return true - } - } - return false -} diff --git a/pkg/config/load_test.go b/pkg/config/load_test.go index 8a44976a386..83d160133aa 100644 --- a/pkg/config/load_test.go +++ b/pkg/config/load_test.go @@ -1,15 +1,11 @@ package config import ( - "errors" "testing" "github.com/google/go-cmp/cmp" - prowv1 "sigs.k8s.io/prow/pkg/apis/prowjobs/v1" - "github.com/openshift/ci-tools/pkg/api" - "github.com/openshift/ci-tools/pkg/testhelper" ) func TestExtractRepoElementsFromPath(t *testing.T) { @@ -95,268 +91,3 @@ func TestExtractRepoElementsFromPath(t *testing.T) { }) } } - -func TestValidateProwgenConfig(t *testing.T) { - testCases := []struct { - name string - pConfig *Prowgen - expected error - }{ - { - name: "valid", - pConfig: &Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#slack-channel", - JobStatesToReport: []prowv1.ProwJobState{"error"}, - ReportTemplate: "some template", - JobNames: []string{"unit", "e2e"}, - }, - { - Channel: "#slack-channel", - JobStatesToReport: []prowv1.ProwJobState{"success"}, - ReportTemplate: "some other template", - JobNames: []string{"lint"}, - }, - }, - }, - }, - { - name: "invalid, same job in multiple slack reporter configs", - pConfig: &Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#slack-channel", - JobStatesToReport: []prowv1.ProwJobState{"error"}, - ReportTemplate: "some template", - JobNames: []string{"unit", "e2e"}, - }, - { - Channel: "#slack-channel", - JobStatesToReport: []prowv1.ProwJobState{"success"}, - ReportTemplate: "some other template", - JobNames: []string{"unit"}, - }, - }, - }, - expected: errors.New("job: unit exists in multiple slack_reporter_configs, it should only be in one"), - }, - { - name: "invalid regex patterns cause validation errors", - pConfig: &Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#slack-channel", - JobNamePatterns: []string{"[invalid"}, - }, - { - Channel: "#other-channel", - JobNamePatterns: []string{"^valid.*"}, - }, - }, - }, - expected: errors.New("invalid regex pattern: [invalid, error: error parsing regexp: missing closing ]: `[invalid`"), - }, - { - name: "duplicate regex patterns cause validation errors", - pConfig: &Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#slack-channel", - JobNamePatterns: []string{"^unit.*"}, - }, - { - Channel: "#other-channel", - JobNamePatterns: []string{"^unit.*"}, - }, - }, - }, - expected: errors.New("regex pattern: ^unit.* exists in multiple slack_reporter_configs, it should only be in one"), - }, - { - name: "valid regex patterns pass validation", - pConfig: &Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#slack-channel", - JobNamePatterns: []string{"^unit.*", "^e2e.*"}, - }, - { - Channel: "#other-channel", - JobNamePatterns: []string{"^integration.*"}, - }, - }, - }, - }, - { - name: "invalid excluded job patterns cause validation errors", - pConfig: &Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#slack-channel", - ExcludedJobPatterns: []string{"[invalid"}, - }, - { - Channel: "#other-channel", - ExcludedJobPatterns: []string{"^valid.*"}, - }, - }, - }, - expected: errors.New("invalid excluded job pattern: [invalid, error: error parsing regexp: missing closing ]: `[invalid`"), - }, - { - name: "valid excluded job patterns pass validation", - pConfig: &Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#slack-channel", - JobNamePatterns: []string{".*"}, - ExcludedJobPatterns: []string{".*-skip$", "^nightly-.*"}, - }, - { - Channel: "#other-channel", - JobNames: []string{"unit", "e2e"}, - ExcludedJobPatterns: []string{".*-flaky$"}, - }, - }, - }, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := validateProwgenConfig(tc.pConfig) - if diff := cmp.Diff(result, tc.expected, testhelper.EquateErrorMessage); diff != "" { - t.Fatalf("result doesn't match expected, diff: %v", diff) - } - }) - } -} - -func TestValidateProwgenSkipOperatorPresubmits(t *testing.T) { - testCases := []struct { - name string - pConfig *Prowgen - branch string - variant string - expected bool - }{ - { - name: "skipping operator presubmits, exactly match", - pConfig: &Prowgen{ - SkipOperatorPresubmits: []SkipOperatorPresubmits{ - { - Branch: "main", - Variant: "4.18", - }, - { - Branch: "dev", - Variant: "4.19", - }, - }, - }, - branch: "main", - variant: "4.18", - expected: true, - }, - { - name: "generating operator presubmits, mismatch branches", - pConfig: &Prowgen{ - SkipOperatorPresubmits: []SkipOperatorPresubmits{ - { - Branch: "dev", - Variant: "4.18", - }, - }, - }, - branch: "main", - variant: "4.18", - expected: false, - }, - { - name: "skipping operator presubmits, empty values", - pConfig: &Prowgen{}, - branch: "main", - variant: "4.19", - expected: false, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - if tc.pConfig.SkipOperatorPresubmits != nil { - skip := tc.pConfig.SkipPresubmits(tc.branch, tc.variant) - if skip != tc.expected { - t.Fatalf("result doesn't match, expected %v, received %v", tc.expected, skip) - } - } - }) - } -} - -func TestProwgen_MergeDefaults_SlackReporterConfigs(t *testing.T) { - testCases := []struct { - name string - base Prowgen - defaults Prowgen - expected []SlackReporterConfig - }{ - { - name: "slack reporter configs are never merged from defaults", - base: Prowgen{}, - defaults: Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#test-channel", - JobStatesToReport: []prowv1.ProwJobState{"failure"}, - JobNamePatterns: []string{".*"}, - ExcludedJobPatterns: []string{".*-skip$"}, - }, - }, - }, - expected: nil, - }, - { - name: "existing slack reporter configs are preserved unchanged", - base: Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#existing-channel", - JobStatesToReport: []prowv1.ProwJobState{"error"}, - JobNames: []string{"unit"}, - }, - }, - }, - defaults: Prowgen{ - SlackReporterConfigs: []SlackReporterConfig{ - { - Channel: "#default-channel", - JobStatesToReport: []prowv1.ProwJobState{"failure"}, - JobNamePatterns: []string{".*"}, - ExcludedJobPatterns: []string{".*-skip$"}, - }, - }, - }, - expected: []SlackReporterConfig{ - { - Channel: "#existing-channel", - JobStatesToReport: []prowv1.ProwJobState{"error"}, - JobNames: []string{"unit"}, - }, - }, - }, - { - name: "empty base with empty defaults stays empty", - base: Prowgen{}, - defaults: Prowgen{}, - expected: nil, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - tc.base.MergeDefaults(&tc.defaults) - if diff := cmp.Diff(tc.base.SlackReporterConfigs, tc.expected); diff != "" { - t.Fatalf("SlackReporterConfigs don't match expected, diff: %v", diff) - } - }) - } -} diff --git a/pkg/controller/ephemeralcluster/reconciler.go b/pkg/controller/ephemeralcluster/reconciler.go index 55e521ec11d..6e739d74d20 100644 --- a/pkg/controller/ephemeralcluster/reconciler.go +++ b/pkg/controller/ephemeralcluster/reconciler.go @@ -413,12 +413,10 @@ func (r *reconciler) createProwJob(ctx context.Context, log *logrus.Entry, ec *e } func (r *reconciler) makeProwJob(ciOperatorConfig *api.ReleaseBuildConfiguration, ec *ephemeralclusterv1.EphemeralCluster) (*prowv1.ProwJob, error) { - jobConfig, err := prowgen.GenerateJobs(ciOperatorConfig, &prowgen.ProwgenInfo{ - Metadata: api.Metadata{ - Org: "org", - Repo: "repo", - Branch: "branch", - }, + jobConfig, err := prowgen.GenerateJobs(ciOperatorConfig, &api.Metadata{ + Org: "org", + Repo: "repo", + Branch: "branch", }) if err != nil { return nil, fmt.Errorf("generate jobs: %w", err) diff --git a/pkg/controller/prpqr_reconciler/prpqr_reconciler.go b/pkg/controller/prpqr_reconciler/prpqr_reconciler.go index 187cc844582..56321508d11 100644 --- a/pkg/controller/prpqr_reconciler/prpqr_reconciler.go +++ b/pkg/controller/prpqr_reconciler/prpqr_reconciler.go @@ -587,7 +587,6 @@ func (r *reconciler) generateProwjob(ciopConfig *api.ReleaseBuildConfiguration, imageTagOverrides []v1.ImageTagOverride, shardCount, shardIndex int, ) (*prowv1.ProwJob, error) { - fakeProwgenInfo := &prowgen.ProwgenInfo{Metadata: *baseCiop} annotations := map[string]string{ releaseJobNameAnnotation: mimickedJob, @@ -625,7 +624,7 @@ func (r *reconciler) generateProwjob(ciopConfig *api.ReleaseBuildConfiguration, test.Timeout.Duration = r.defaultMultiRefJobTimeout } } - jobBaseGen := prowgen.NewProwJobBaseBuilderForTest(ciopConfig, fakeProwgenInfo, prowgen.NewCiOperatorPodSpecGenerator(), test) + jobBaseGen := prowgen.NewProwJobBaseBuilderForTest(ciopConfig, baseCiop, prowgen.NewCiOperatorPodSpecGenerator(), test) jobBaseGen.PodSpec.Add(prowgen.InjectTestFrom(inject)) if latestPayloadPullspec != "" { jobBaseGen.PodSpec.Add(prowgen.ReleaseLatest(latestPayloadPullspec)) @@ -659,7 +658,7 @@ func (r *reconciler) generateProwjob(ciopConfig *api.ReleaseBuildConfiguration, } jobBaseGen.Cluster(cioperatorapi.Cluster(cluster)) - periodic = prowgen.GeneratePeriodicForTest(jobBaseGen, fakeProwgenInfo, prowgen.FromConfigSpec(ciopConfig), func(options *prowgen.GeneratePeriodicOptions) { + periodic = prowgen.GeneratePeriodicForTest(jobBaseGen, baseCiop, prowgen.FromConfigSpec(ciopConfig), func(options *prowgen.GeneratePeriodicOptions) { options.Cron = "@yearly" }) periodic.Name = generateJobNameToSubmit(inject, prs, shardCount, shardIndex) @@ -836,9 +835,10 @@ func generateAggregatorJob(baseCiop *api.Metadata, uid, aggregatorJobName, jobNa return nil, fmt.Errorf("couldn't marshal ci-operator config") } - jobBaseGen := prowgen.NewProwJobBaseBuilderForTest(ciopConfig, &prowgen.ProwgenInfo{}, prowgen.NewCiOperatorPodSpecGenerator(), ciopConfig.Tests[0]) + emptyMetadata := &api.Metadata{} + jobBaseGen := prowgen.NewProwJobBaseBuilderForTest(ciopConfig, emptyMetadata, prowgen.NewCiOperatorPodSpecGenerator(), ciopConfig.Tests[0]) - periodic := prowgen.GeneratePeriodicForTest(jobBaseGen, &prowgen.ProwgenInfo{}, prowgen.FromConfigSpec(ciopConfig), func(options *prowgen.GeneratePeriodicOptions) { + periodic := prowgen.GeneratePeriodicForTest(jobBaseGen, emptyMetadata, prowgen.FromConfigSpec(ciopConfig), func(options *prowgen.GeneratePeriodicOptions) { options.Cron = "@yearly" }) periodic.Name = aggregatorJobName diff --git a/pkg/image-graph-generator/operator.go b/pkg/image-graph-generator/operator.go index a16e5f59018..0278cefeda5 100644 --- a/pkg/image-graph-generator/operator.go +++ b/pkg/image-graph-generator/operator.go @@ -79,25 +79,6 @@ func (o *Operator) callback(c *api.ReleaseBuildConfiguration, i *config.Info) er return nil } - configProwgen := &config.Prowgen{} - orgProwgenConfig, err := config.LoadProwgenConfig(i.OrgPath) - if err != nil { - return err - } - - repoProwgenConfig, err := config.LoadProwgenConfig(i.RepoPath) - if err != nil { - return err - } - - if repoProwgenConfig != nil { - configProwgen = repoProwgenConfig - } - - if orgProwgenConfig != nil { - configProwgen.MergeDefaults(orgProwgenConfig) - } - var errs []error for _, target := range api.PromotionTargets(c.PromotionConfiguration) { excludedImages := sets.New[string](target.ExcludedImages...) diff --git a/pkg/prowgen/jobbase.go b/pkg/prowgen/jobbase.go index ec865d33757..749a5ae93f5 100644 --- a/pkg/prowgen/jobbase.go +++ b/pkg/prowgen/jobbase.go @@ -18,7 +18,7 @@ type prowJobBaseBuilder struct { PodSpec CiOperatorPodSpecGenerator base prowconfig.JobBase - info *ProwgenInfo + info *cioperatorapi.Metadata testName string } @@ -58,7 +58,7 @@ func sparseCheckoutFiles(configSpec *cioperatorapi.ReleaseBuildConfiguration) [] return sets.List(files) } -func hasNoBuilds(c *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo) bool { +func hasNoBuilds(c *cioperatorapi.ReleaseBuildConfiguration, info *cioperatorapi.Metadata) bool { if c == nil { return false } @@ -76,7 +76,7 @@ func hasNoBuilds(c *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo) // from the given ReleaseBuildConfiguration, Prowgen config. The embedded PodSpec // is built using an injected CiOperatorPodSpecGenerator, not directly. The embedded // PodSpec is not built until the Build method is called. -func NewProwJobBaseBuilder(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo, podSpecGenerator CiOperatorPodSpecGenerator) *prowJobBaseBuilder { +func NewProwJobBaseBuilder(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *cioperatorapi.Metadata, podSpecGenerator CiOperatorPodSpecGenerator) *prowJobBaseBuilder { b := &prowJobBaseBuilder{ PodSpec: podSpecGenerator, base: prowconfig.JobBase{ @@ -89,8 +89,8 @@ func NewProwJobBaseBuilder(configSpec *cioperatorapi.ReleaseBuildConfiguration, }, } - private := info.Config.Private || (configSpec.Prowgen != nil && configSpec.Prowgen.Private) - expose := info.Config.Expose || (configSpec.Prowgen != nil && configSpec.Prowgen.Expose) + private := configSpec.Prowgen != nil && configSpec.Prowgen.Private + expose := configSpec.Prowgen != nil && configSpec.Prowgen.Expose sparseFiles := sparseCheckoutFiles(configSpec) shouldSkipCloning := len(sparseFiles) == 0 @@ -137,7 +137,7 @@ func NewProwJobBaseBuilder(configSpec *cioperatorapi.ReleaseBuildConfiguration, // NewProwJobBaseBuilderForTest creates a new builder populated with defaults // for the given ci-operator test. The resulting builder is a superset of a // one built by NewProwJobBaseBuilder, with additional fields set for test -func NewProwJobBaseBuilderForTest(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo, podSpecGenerator CiOperatorPodSpecGenerator, test cioperatorapi.TestStepConfiguration) *prowJobBaseBuilder { +func NewProwJobBaseBuilderForTest(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *cioperatorapi.Metadata, podSpecGenerator CiOperatorPodSpecGenerator, test cioperatorapi.TestStepConfiguration) *prowJobBaseBuilder { p := NewProwJobBaseBuilder(configSpec, info, podSpecGenerator) if test.Cluster != "" { p.Cluster(test.Cluster) @@ -175,7 +175,7 @@ func NewProwJobBaseBuilderForTest(configSpec *cioperatorapi.ReleaseBuildConfigur if configSpec.Releases != nil { p.PodSpec.Add(CIPullSecret()) } - if info.Config.EnableSecretsStoreCSIDriver || (configSpec.Prowgen != nil && configSpec.Prowgen.EnableSecretsStoreCSIDriver) { + if configSpec.Prowgen != nil && configSpec.Prowgen.EnableSecretsStoreCSIDriver { p.PodSpec.Add( GSMConfig(), ) @@ -189,7 +189,7 @@ func NewProwJobBaseBuilderForTest(configSpec *cioperatorapi.ReleaseBuildConfigur if configSpec.Releases != nil { p.PodSpec.Add(CIPullSecret()) } - if info.Config.EnableSecretsStoreCSIDriver || (configSpec.Prowgen != nil && configSpec.Prowgen.EnableSecretsStoreCSIDriver) { + if configSpec.Prowgen != nil && configSpec.Prowgen.EnableSecretsStoreCSIDriver { p.PodSpec.Add( GSMConfig(), ) diff --git a/pkg/prowgen/jobbase_test.go b/pkg/prowgen/jobbase_test.go index cd1de9b875c..a72ad9e6282 100644 --- a/pkg/prowgen/jobbase_test.go +++ b/pkg/prowgen/jobbase_test.go @@ -9,17 +9,14 @@ import ( v1 "sigs.k8s.io/prow/pkg/apis/prowjobs/v1" ciop "github.com/openshift/ci-tools/pkg/api" - "github.com/openshift/ci-tools/pkg/config" "github.com/openshift/ci-tools/pkg/testhelper" ) func TestProwJobBaseBuilder(t *testing.T) { - defaultInfo := &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "org", - Repo: "repo", - Branch: "branch", - }, + defaultInfo := &ciop.Metadata{ + Org: "org", + Repo: "repo", + Branch: "branch", } t.Parallel() testCases := []struct { @@ -32,7 +29,7 @@ func TestProwJobBaseBuilder(t *testing.T) { prowgenOverrides *ciop.ProwgenOverrides podSpecBuilder CiOperatorPodSpecGenerator - info *ProwgenInfo + info *ciop.Metadata prefix string }{ { @@ -48,10 +45,8 @@ func TestProwJobBaseBuilder(t *testing.T) { podSpecBuilder: newFakePodSpecBuilder(), }, { - name: "job with a variant", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch", Variant: "variant"}, - }, + name: "job with a variant", + info: &ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch", Variant: "variant"}, prefix: "default", podSpecBuilder: newFakePodSpecBuilder(), }, @@ -89,18 +84,14 @@ func TestProwJobBaseBuilder(t *testing.T) { podSpecBuilder: newFakePodSpecBuilder(), }, { - name: "job with no builds in openshift/release@main: does have `no-builds` label", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, - }, + name: "job with no builds in openshift/release@main: does have `no-builds` label", + info: &ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, prefix: "default", podSpecBuilder: newFakePodSpecBuilder(), }, { name: "job with a buildroot in of openshift/release@main: does not have `no-builds` label", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, - }, + info: &ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, inputs: ciop.InputConfiguration{ BuildRootImage: &ciop.BuildRootImageConfiguration{ ProjectImageBuild: &ciop.ProjectDirectoryImageBuildInputs{}, @@ -110,28 +101,22 @@ func TestProwJobBaseBuilder(t *testing.T) { podSpecBuilder: newFakePodSpecBuilder(), }, { - name: "job with binary build in openshift/release@main: does not have `no-builds` label", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, - }, + name: "job with binary build in openshift/release@main: does not have `no-builds` label", + info: &ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, binCommand: "make", prefix: "default", podSpecBuilder: newFakePodSpecBuilder(), }, { - name: "job with test binary build in of openshift/release@main: does not have `no-builds` label", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, - }, + name: "job with test binary build in of openshift/release@main: does not have `no-builds` label", + info: &ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, testBinCommand: "make test", prefix: "default", podSpecBuilder: newFakePodSpecBuilder(), }, { - name: "job with image builds in of openshift/release@main: does not have `no-builds` label", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, - }, + name: "job with image builds in of openshift/release@main: does not have `no-builds` label", + info: &ciop.Metadata{Org: "openshift", Repo: "release", Branch: "main"}, images: ciop.ImageConfiguration{Items: []ciop.ProjectDirectoryImageBuildStepConfiguration{{From: "base", To: "image"}}}, prefix: "default", podSpecBuilder: newFakePodSpecBuilder(), @@ -143,29 +128,23 @@ func TestProwJobBaseBuilder(t *testing.T) { podSpecBuilder: NewCiOperatorPodSpecGenerator(), }, { - name: "job with a variant, including podspec", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch", Variant: "variant"}, - }, + name: "job with a variant, including podspec", + info: &ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch", Variant: "variant"}, prefix: "default", podSpecBuilder: NewCiOperatorPodSpecGenerator(), }, { - name: "private job without cloning, including podspec", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}, - Config: config.Prowgen{Private: true}, - }, - prefix: "default", - podSpecBuilder: NewCiOperatorPodSpecGenerator(), + name: "private job without cloning, including podspec", + info: &ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}, + prowgenOverrides: &ciop.ProwgenOverrides{Private: true}, + prefix: "default", + podSpecBuilder: NewCiOperatorPodSpecGenerator(), }, { - name: "private job with cloning, including podspec", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}, - Config: config.Prowgen{Private: true}, - }, - prefix: "default", + name: "private job with cloning, including podspec", + info: &ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}, + prowgenOverrides: &ciop.ProwgenOverrides{Private: true}, + prefix: "default", inputs: ciop.InputConfiguration{ BuildRootImage: &ciop.BuildRootImageConfiguration{FromRepository: true}, }, @@ -173,14 +152,14 @@ func TestProwJobBaseBuilder(t *testing.T) { }, { name: "private job via ci-operator config", - info: &ProwgenInfo{Metadata: ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}}, + info: &ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}, prowgenOverrides: &ciop.ProwgenOverrides{Private: true}, prefix: "default", podSpecBuilder: NewCiOperatorPodSpecGenerator(), }, { name: "private job with expose via ci-operator config", - info: &ProwgenInfo{Metadata: ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}}, + info: &ciop.Metadata{Org: "vorg", Repo: "vrepo", Branch: "vbranch"}, prowgenOverrides: &ciop.ProwgenOverrides{Private: true, Expose: true}, prefix: "default", podSpecBuilder: NewCiOperatorPodSpecGenerator(), @@ -196,7 +175,7 @@ func TestProwJobBaseBuilder(t *testing.T) { Images: tc.images, BinaryBuildCommands: tc.binCommand, TestBinaryBuildCommands: tc.testBinCommand, - Metadata: tc.info.Metadata, + Metadata: *tc.info, Prowgen: tc.prowgenOverrides, } b := NewProwJobBaseBuilder(ciopconfig, tc.info, tc.podSpecBuilder).Build(tc.prefix) @@ -209,61 +188,56 @@ func TestGenerateJobBase(t *testing.T) { var testCases = []struct { testName string name string - info *ProwgenInfo + info *ciop.Metadata + prowgenOverrides *ciop.ProwgenOverrides canonicalGoRepository string rehearsable bool }{ { testName: "no special options", name: "test", - info: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + info: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, }, { testName: "rehearsable", name: "test", - info: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + info: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, rehearsable: true, }, { testName: "config variant", name: "test", - info: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "whatever"}}, + info: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "whatever"}, }, { testName: "path alias", name: "test", canonicalGoRepository: "/some/where", - info: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "whatever"}}, + info: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "whatever"}, }, { - testName: "hidden job for private repos", - name: "test", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, - Config: config.Prowgen{Private: true}, - }, + testName: "hidden job for private repos", + name: "test", + info: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, + prowgenOverrides: &ciop.ProwgenOverrides{Private: true}, }, { - testName: "expose job for private repos with public results", - name: "test", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, - Config: config.Prowgen{Private: true, Expose: true}, - }, + testName: "expose job for private repos with public results", + name: "test", + info: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, + prowgenOverrides: &ciop.ProwgenOverrides{Private: true, Expose: true}, }, { - testName: "expose option set but not private", - name: "test", - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, - Config: config.Prowgen{Private: false, Expose: true}, - }, + testName: "expose option set but not private", + name: "test", + info: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, + prowgenOverrides: &ciop.ProwgenOverrides{Expose: true}, }, } for _, testCase := range testCases { t.Run(testCase.testName, func(t *testing.T) { - jobBaseGen := NewProwJobBaseBuilder(&ciop.ReleaseBuildConfiguration{CanonicalGoRepository: &testCase.canonicalGoRepository}, testCase.info, newFakePodSpecBuilder()).Rehearsable(testCase.rehearsable).TestName(testCase.name) + jobBaseGen := NewProwJobBaseBuilder(&ciop.ReleaseBuildConfiguration{CanonicalGoRepository: &testCase.canonicalGoRepository, Prowgen: testCase.prowgenOverrides}, testCase.info, newFakePodSpecBuilder()).Rehearsable(testCase.rehearsable).TestName(testCase.name) testhelper.CompareWithFixture(t, jobBaseGen.Build("pull")) }) } @@ -271,13 +245,13 @@ func TestGenerateJobBase(t *testing.T) { func TestNewProwJobBaseBuilderForTest(t *testing.T) { ciopconfig := &ciop.ReleaseBuildConfiguration{} - defaultInfo := &ProwgenInfo{Metadata: ciop.Metadata{Org: "o", Repo: "r", Branch: "b"}} + defaultInfo := &ciop.Metadata{Org: "o", Repo: "r", Branch: "b"} testCases := []struct { name string cfg *ciop.ReleaseBuildConfiguration test ciop.TestStepConfiguration - info *ProwgenInfo + info *ciop.Metadata }{ { name: "simple container-based test", @@ -347,28 +321,28 @@ func TestNewProwJobBaseBuilderForTest(t *testing.T) { }, { name: "multi-stage test with CSI enabled", + cfg: &ciop.ReleaseBuildConfiguration{ + Prowgen: &ciop.ProwgenOverrides{EnableSecretsStoreCSIDriver: true}, + }, test: ciop.TestStepConfiguration{ As: "simple", MultiStageTestConfiguration: &ciop.MultiStageTestConfiguration{ Workflow: pointer.StringPtr("workflow"), }, }, - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "o", Repo: "r", Branch: "b"}, - Config: config.Prowgen{EnableSecretsStoreCSIDriver: true}, - }, + info: defaultInfo, }, { name: "simple test with CSI enabled", + cfg: &ciop.ReleaseBuildConfiguration{ + Prowgen: &ciop.ProwgenOverrides{EnableSecretsStoreCSIDriver: true}, + }, test: ciop.TestStepConfiguration{ As: "simple", Commands: "make", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "src"}, }, - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "o", Repo: "r", Branch: "b"}, - Config: config.Prowgen{EnableSecretsStoreCSIDriver: true}, - }, + info: defaultInfo, }, { name: "multi-stage test with CSI enabled via ci-operator config", @@ -453,42 +427,13 @@ func TestNewProwJobBaseBuilderForTest(t *testing.T) { As: "unit", Commands: "make unit", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "src"}, - }, - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "o", Repo: "r", Branch: "b"}, - Config: config.Prowgen{ - SlackReporterConfigs: []config.SlackReporterConfig{ - { - Channel: "some-channel", - JobStatesToReport: []prowv1.ProwJobState{"error"}, - ReportTemplate: "some template", - JobNames: []string{"unit", "e2e"}, - }, - }, - }, - }, - }, - { - name: "job excluded by patterns should not have slack reporter config", - test: ciop.TestStepConfiguration{ - As: "unit-skip", - Commands: "make unit", - ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "src"}, - }, - info: &ProwgenInfo{ - Metadata: ciop.Metadata{Org: "o", Repo: "r", Branch: "b"}, - Config: config.Prowgen{ - SlackReporterConfigs: []config.SlackReporterConfig{ - { - Channel: "some-channel", - JobStatesToReport: []prowv1.ProwJobState{"error"}, - ReportTemplate: "some template", - JobNames: []string{"unit-skip", "e2e"}, - ExcludedJobPatterns: []string{".*-skip$"}, - }, - }, + SlackReporterConfig: &ciop.SlackReporterConfig{ + Channel: "some-channel", + JobStatesToReport: []prowv1.ProwJobState{"error"}, + ReportTemplate: "some template", }, }, + info: defaultInfo, }, } for _, tc := range testCases { @@ -505,15 +450,13 @@ func TestNewProwJobBaseBuilderForTest(t *testing.T) { } func TestMiscellaneous(t *testing.T) { - defaultInfo := &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "org", - Repo: "repo", - Branch: "branch", - }, + defaultInfo := &ciop.Metadata{ + Org: "org", + Repo: "repo", + Branch: "branch", } defaultConfig := &ciop.ReleaseBuildConfiguration{ - Metadata: defaultInfo.Metadata, + Metadata: *defaultInfo, } simpleBuilder := func() *prowJobBaseBuilder { return NewProwJobBaseBuilder(defaultConfig, defaultInfo, newFakePodSpecBuilder()) diff --git a/pkg/prowgen/prowgen.go b/pkg/prowgen/prowgen.go index 5fed848944d..7663a360821 100644 --- a/pkg/prowgen/prowgen.go +++ b/pkg/prowgen/prowgen.go @@ -9,7 +9,6 @@ import ( prowconfig "sigs.k8s.io/prow/pkg/config" cioperatorapi "github.com/openshift/ci-tools/pkg/api" - "github.com/openshift/ci-tools/pkg/config" jc "github.com/openshift/ci-tools/pkg/jobconfig" ) @@ -19,11 +18,6 @@ const ( Generator jc.Generator = "prowgen" ) -type ProwgenInfo struct { - cioperatorapi.Metadata - Config config.Prowgen -} - // GenerateJobs // Given a ci-operator configuration file and basic information about what // should be tested, generate a following JobConfig: @@ -37,17 +31,12 @@ type ProwgenInfo struct { // new jobs are generated with GenerateJobs, the call site should also use // Prune() function to remove all stale jobs and label the jobs as simply // "generated". -func GenerateJobs(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo) (*prowconfig.JobConfig, error) { +func GenerateJobs(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *cioperatorapi.Metadata) (*prowconfig.JobConfig, error) { orgrepo := fmt.Sprintf("%s/%s", info.Org, info.Repo) presubmits := map[string][]prowconfig.Presubmit{} postsubmits := map[string][]prowconfig.Postsubmit{} var periodics []prowconfig.Periodic - prowgenConfig := info.Config - if configSpec.Prowgen != nil && configSpec.Prowgen.DisableRehearsals { - prowgenConfig.Rehearsals.DisableAll = true - } - rehearsals := prowgenConfig.Rehearsals - disabledRehearsals := sets.New[string](rehearsals.DisabledRehearsals...) + disableAllRehearsals := configSpec.Prowgen != nil && configSpec.Prowgen.DisableRehearsals for _, element := range configSpec.Tests { shardCount := 1 @@ -69,7 +58,7 @@ func GenerateJobs(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *Pro g.WithLabel(fmt.Sprintf("capability/%s", element.NodeArchitecture), string(element.NodeArchitecture)) } - disableRehearsal := rehearsals.DisableAll || disabledRehearsals.Has(element.As) || element.DisableRehearsal + disableRehearsal := disableAllRehearsals || element.DisableRehearsal if element.IsPeriodic() { cron := "" @@ -187,8 +176,7 @@ func GenerateJobs(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *Pro } } - skipOperatorPresubmits := info.Config.SkipPresubmits(configSpec.Metadata.Branch, configSpec.Metadata.Variant) || - (configSpec.Prowgen != nil && configSpec.Prowgen.SkipOperatorPresubmits) + skipOperatorPresubmits := configSpec.Prowgen != nil && configSpec.Prowgen.SkipOperatorPresubmits if configSpec.Operator != nil && !skipOperatorPresubmits { containsUnnamedBundle := false for _, bundle := range configSpec.Operator.Bundles { @@ -226,7 +214,7 @@ func GenerateJobs(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *Pro }, nil } -func handlePresubmit(g *prowJobBaseBuilder, element cioperatorapi.TestStepConfiguration, info *ProwgenInfo, name string, disableRehearsal bool, requests cioperatorapi.ResourceList, presubmits map[string][]prowconfig.Presubmit, orgrepo string, fromPeriodic bool) { +func handlePresubmit(g *prowJobBaseBuilder, element cioperatorapi.TestStepConfiguration, info *cioperatorapi.Metadata, name string, disableRehearsal bool, requests cioperatorapi.ResourceList, presubmits map[string][]prowconfig.Presubmit, orgrepo string, fromPeriodic bool) { slackConfig := element.SlackReporterConfig if fromPeriodic && (slackConfig == nil || !slackConfig.ReportPresubmit) { slackConfig = nil @@ -269,35 +257,24 @@ func (opts *generatePresubmitOptions) shouldAlwaysRun() bool { type generatePresubmitOption func(options *generatePresubmitOptions) -// slackReporterConfig returns the Slack reporter configuration for a job. -// Per-test config (from ci-operator config) takes precedence over .config.prowgen. -func slackReporterConfig(jobName, testName string, testSlackConfig *cioperatorapi.SlackReporterConfig, info *ProwgenInfo) *prowv1.ReporterConfig { - if testSlackConfig != nil { - jobStatesToReport := testSlackConfig.JobStatesToReport - if len(jobStatesToReport) == 0 { - jobStatesToReport = cioperatorapi.DefaultSlackReporterJobStatesToReport - } - return &prowv1.ReporterConfig{ - Slack: &prowv1.SlackReporterConfig{ - Channel: testSlackConfig.Channel, - JobStatesToReport: jobStatesToReport, - ReportTemplate: testSlackConfig.ReportTemplate, - }, - } +func slackReporterConfig(testSlackConfig *cioperatorapi.SlackReporterConfig) *prowv1.ReporterConfig { + if testSlackConfig == nil { + return nil } - if slackReporter := info.Config.GetSlackReporterConfigForJobName(jobName, testName, info.Metadata.Variant); slackReporter != nil { - return &prowv1.ReporterConfig{ - Slack: &prowv1.SlackReporterConfig{ - Channel: slackReporter.Channel, - JobStatesToReport: slackReporter.JobStatesToReport, - ReportTemplate: slackReporter.ReportTemplate, - }, - } + jobStatesToReport := testSlackConfig.JobStatesToReport + if len(jobStatesToReport) == 0 { + jobStatesToReport = cioperatorapi.DefaultSlackReporterJobStatesToReport + } + return &prowv1.ReporterConfig{ + Slack: &prowv1.SlackReporterConfig{ + Channel: testSlackConfig.Channel, + JobStatesToReport: jobStatesToReport, + ReportTemplate: testSlackConfig.ReportTemplate, + }, } - return nil } -func generatePresubmitForTest(jobBaseBuilder *prowJobBaseBuilder, name string, info *ProwgenInfo, options ...generatePresubmitOption) *prowconfig.Presubmit { +func generatePresubmitForTest(jobBaseBuilder *prowJobBaseBuilder, name string, info *cioperatorapi.Metadata, options ...generatePresubmitOption) *prowconfig.Presubmit { opts := &generatePresubmitOptions{} for _, opt := range options { opt(opts) @@ -306,8 +283,7 @@ func generatePresubmitForTest(jobBaseBuilder *prowJobBaseBuilder, name string, i shortName := info.TestName(name) base := jobBaseBuilder.Rehearsable(!opts.disableRehearsal).Build(jc.PresubmitPrefix) - fullJobName := info.JobName(jc.PresubmitPrefix, name) - base.ReporterConfig = slackReporterConfig(fullJobName, name, opts.slackReporterConfig, info) + base.ReporterConfig = slackReporterConfig(opts.slackReporterConfig) pipelineOpt := false if opts.pipelineRunIfChanged != "" { @@ -357,7 +333,7 @@ type generatePostsubmitOptions struct { type generatePostsubmitOption func(options *generatePostsubmitOptions) -func generatePostsubmitForTest(jobBaseBuilder *prowJobBaseBuilder, info *ProwgenInfo, options ...generatePostsubmitOption) *prowconfig.Postsubmit { +func generatePostsubmitForTest(jobBaseBuilder *prowJobBaseBuilder, info *cioperatorapi.Metadata, options ...generatePostsubmitOption) *prowconfig.Postsubmit { opts := &generatePostsubmitOptions{} for _, opt := range options { opt(opts) @@ -365,9 +341,7 @@ func generatePostsubmitForTest(jobBaseBuilder *prowJobBaseBuilder, info *Prowgen base := jobBaseBuilder.Build(jc.PostsubmitPrefix) - testName := jobBaseBuilder.testName - fullJobName := info.JobName(jc.PostsubmitPrefix, testName) - base.ReporterConfig = slackReporterConfig(fullJobName, testName, opts.slackReporterConfig, info) + base.ReporterConfig = slackReporterConfig(opts.slackReporterConfig) alwaysRun := opts.runIfChanged == "" && opts.skipIfOnlyChanged == "" pj := &prowconfig.Postsubmit{ @@ -416,7 +390,7 @@ func FromConfigSpec(configSpec *cioperatorapi.ReleaseBuildConfiguration) Generat } } -func GeneratePeriodicForTest(jobBaseBuilder *prowJobBaseBuilder, info *ProwgenInfo, options ...GeneratePeriodicOption) *prowconfig.Periodic { +func GeneratePeriodicForTest(jobBaseBuilder *prowJobBaseBuilder, info *cioperatorapi.Metadata, options ...GeneratePeriodicOption) *prowconfig.Periodic { opts := &GeneratePeriodicOptions{} for _, opt := range options { opt(opts) @@ -425,9 +399,7 @@ func GeneratePeriodicForTest(jobBaseBuilder *prowJobBaseBuilder, info *ProwgenIn // We are resetting PathAlias because it will be set on the `ExtraRefs` item base := jobBaseBuilder.Rehearsable(!opts.DisableRehearsal).PathAlias("").Build(jc.PeriodicPrefix) - testName := jobBaseBuilder.testName - fullJobName := info.JobName(jc.PeriodicPrefix, testName) - base.ReporterConfig = slackReporterConfig(fullJobName, testName, opts.SlackReporterConfig, info) + base.ReporterConfig = slackReporterConfig(opts.SlackReporterConfig) cron := opts.Cron if cron == "@daily" { diff --git a/pkg/prowgen/prowgen_test.go b/pkg/prowgen/prowgen_test.go index 472d1363c1f..9f3035c9e70 100644 --- a/pkg/prowgen/prowgen_test.go +++ b/pkg/prowgen/prowgen_test.go @@ -7,12 +7,10 @@ import ( corev1 "k8s.io/api/core/v1" utilpointer "k8s.io/utils/pointer" - prowv1 "sigs.k8s.io/prow/pkg/apis/prowjobs/v1" prowconfig "sigs.k8s.io/prow/pkg/config" "github.com/openshift/ci-tools/pkg/api" ciop "github.com/openshift/ci-tools/pkg/api" - "github.com/openshift/ci-tools/pkg/config" "github.com/openshift/ci-tools/pkg/testhelper" ) @@ -117,7 +115,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { description string test string - repoInfo *ProwgenInfo + repoInfo *ciop.Metadata jobRelease string clone bool generateOption generatePresubmitOption @@ -125,17 +123,17 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit for standard test", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, }, { description: "presubmit for a test in a variant config", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "also"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "also"}, }, { description: "presubmit with always_run false", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.defaultDisable = true }, @@ -143,7 +141,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with always_run but run_if_changed set", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.defaultDisable = true options.runIfChanged = ".*" @@ -152,7 +150,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with always_run but pipeline_run_if_changed set", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.defaultDisable = true options.pipelineRunIfChanged = ".*" @@ -161,7 +159,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with always_run=false and pipeline_run_if_changed", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.defaultDisable = false options.pipelineRunIfChanged = ".*" @@ -170,7 +168,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with always_run but pipeline_skip_if_only_changed set", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.defaultDisable = true options.pipelineSkipIfOnlyChanged = "^docs/" @@ -179,7 +177,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with always_run=false and pipeline_skip_if_only_changed", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.defaultDisable = false options.pipelineSkipIfOnlyChanged = "^docs/" @@ -188,7 +186,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with always_run but optional true", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.defaultDisable = true options.optional = true @@ -197,7 +195,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with run_if_changed", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.runIfChanged = "^README.md$" }, @@ -205,7 +203,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with skip_if_only_changed", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.skipIfOnlyChanged = "^README.md$" }, @@ -213,7 +211,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "optional presubmit", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.optional = true }, @@ -221,7 +219,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "rehearsal disabled", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.disableRehearsal = true }, @@ -229,7 +227,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "capabilities added", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.Capabilities = []string{"intranet", "arm64", "rce", "sshd-bastion"} // rce - release-controller-eligible, sshd-bastion - for multiarch P/Z libvirt jobs }, @@ -237,7 +235,7 @@ func TestGeneratePresubmitForTest(t *testing.T) { { description: "presubmit with max_concurrency", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *generatePresubmitOptions) { options.maxConcurrency = 4 }, @@ -261,7 +259,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { description string test string - repoInfo *ProwgenInfo + repoInfo *ciop.Metadata jobRelease string clone bool generateOption GeneratePeriodicOption @@ -269,7 +267,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic for standard test", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *GeneratePeriodicOptions) { options.Cron = "@yearly" }, @@ -277,7 +275,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic for a test with retry", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *GeneratePeriodicOptions) { options.Cron = "@yearly" options.Retry = &prowconfig.Retry{RunAll: true, Attempts: 2, Interval: "3h"} @@ -286,7 +284,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic for a test in a variant config", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "also"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch", Variant: "also"}, generateOption: func(options *GeneratePeriodicOptions) { options.Cron = "@yearly" }, @@ -294,7 +292,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic using interval", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *GeneratePeriodicOptions) { options.Interval = "6h" }, @@ -302,7 +300,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic with disabled rehearsal", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *GeneratePeriodicOptions) { options.DisableRehearsal = true options.Cron = "@yearly" @@ -311,7 +309,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic using minimum_interval", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *GeneratePeriodicOptions) { options.MinimumInterval = "4h" }, @@ -319,7 +317,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic with capabilities", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *GeneratePeriodicOptions) { options.Cron = "@yearly" options.Capabilities = []string{"intranet", "arm64", "rce", "sshd-bastion"} // rce - release-controller-eligible, sshd-bastion - for multiarch P/Z libvirt jobs @@ -328,7 +326,7 @@ func TestGeneratePeriodicForTest(t *testing.T) { { description: "periodic with max_concurrency", test: "testname", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}}, + repoInfo: &ciop.Metadata{Org: "org", Repo: "repo", Branch: "branch"}, generateOption: func(options *GeneratePeriodicOptions) { options.Cron = "@yearly" options.MaxConcurrency = 3 @@ -352,55 +350,55 @@ func TestGeneratePostSubmitForTest(t *testing.T) { testname := "postsubmit" tests := []struct { name string - repoInfo *ProwgenInfo + repoInfo *ciop.Metadata jobRelease string generateOption generatePostsubmitOption }{ { name: "Lowercase org repo and branch", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { name: "Uppercase org, repo and branch", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "Organization", Repo: "Repository", Branch: "Branch", - }}, + }, }, { name: "postsubmit with run_if_changed", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, generateOption: func(options *generatePostsubmitOptions) { options.runIfChanged = "^README.md$" }, }, { name: "postsubmit with capabilities", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, generateOption: func(options *generatePostsubmitOptions) { options.Capabilities = []string{"intranet", "arm64", "rce", "sshd-bastion"} // rce - release-controller-eligible, sshd-bastion - for multiarch P/Z libvirt jobs }, }, { name: "postsubmit with skip_if_only_changed", - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, generateOption: func(options *generatePostsubmitOptions) { options.skipIfOnlyChanged = "^README.md$" }, @@ -428,7 +426,7 @@ func TestGenerateJobs(t *testing.T) { id string keep bool config *ciop.ReleaseBuildConfiguration - repoInfo *ProwgenInfo + repoInfo *ciop.Metadata }{ { id: "two tests and empty Images so only two test presubmits are generated", @@ -437,11 +435,11 @@ func TestGenerateJobs(t *testing.T) { {As: "derTest", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "from"}}, {As: "leTest", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "from"}}}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "two tests and nonempty Images so two test presubmits and images pre/postsubmits are generated ", config: &ciop.ReleaseBuildConfiguration{ @@ -451,11 +449,11 @@ func TestGenerateJobs(t *testing.T) { Images: ciop.ImageConfiguration{Items: []ciop.ProjectDirectoryImageBuildStepConfiguration{{}}}, PromotionConfiguration: &ciop.PromotionConfiguration{}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "promotion postsubmit and periodic ", @@ -463,11 +461,11 @@ func TestGenerateJobs(t *testing.T) { Images: ciop.ImageConfiguration{Items: []ciop.ProjectDirectoryImageBuildStepConfiguration{{}}}, PromotionConfiguration: &ciop.PromotionConfiguration{Cron: "5 4 * * *"}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "Promotion configuration causes --promote job", config: &ciop.ReleaseBuildConfiguration{ @@ -475,11 +473,11 @@ func TestGenerateJobs(t *testing.T) { Images: ciop.ImageConfiguration{Items: []ciop.ProjectDirectoryImageBuildStepConfiguration{{}}}, PromotionConfiguration: &ciop.PromotionConfiguration{Targets: []api.PromotionTarget{{Namespace: "ci"}}}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "Promotion configuration causes --promote job with unique targets", keep: true, @@ -498,11 +496,11 @@ func TestGenerateJobs(t *testing.T) { }}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "no Promotion configuration has no branch job", config: &ciop.ReleaseBuildConfiguration{ @@ -512,11 +510,11 @@ func TestGenerateJobs(t *testing.T) { ReleaseTagConfiguration: &ciop.ReleaseTagConfiguration{Namespace: "openshift"}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "operator section creates ci-index presubmit job", config: &ciop.ReleaseBuildConfiguration{ @@ -528,11 +526,11 @@ func TestGenerateJobs(t *testing.T) { }}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "operator section creates ci-index-my-bundle presubmit job", keep: true, @@ -546,11 +544,11 @@ func TestGenerateJobs(t *testing.T) { }}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "operator section without index creates ci-index-my-bundle presubmit job", keep: true, @@ -565,11 +563,11 @@ func TestGenerateJobs(t *testing.T) { }}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "operator section creates bundle with capabilities", keep: true, @@ -584,11 +582,11 @@ func TestGenerateJobs(t *testing.T) { }}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "skip operator presubmits via ci-operator config", config: &ciop.ReleaseBuildConfiguration{ @@ -602,11 +600,11 @@ func TestGenerateJobs(t *testing.T) { }}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "two tests and empty Images with one test configured as a postsubmit", config: &ciop.ReleaseBuildConfiguration{ @@ -614,11 +612,11 @@ func TestGenerateJobs(t *testing.T) { {As: "derTest", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "from"}}, {As: "leTest", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "from"}, Postsubmit: true}}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "kvm label", config: &ciop.ReleaseBuildConfiguration{ @@ -629,11 +627,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "cluster label for presubmit", @@ -642,11 +640,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", Cluster: "build01", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "cluster label for periodic", @@ -655,11 +653,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", Cron: utilpointer.String(cron), Cluster: "build01", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "periodic with presubmit", @@ -668,11 +666,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", Cron: utilpointer.String(cron), Presubmit: true, Cluster: "build01", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "cluster label for postsubmit", @@ -681,45 +679,42 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", Postsubmit: true, Cluster: "build01", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "disabled rehearsals at job level", config: &ciop.ReleaseBuildConfiguration{ Tests: []ciop.TestStepConfiguration{ - {As: "unit", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, + {As: "unit", DisableRehearsal: true, ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, {As: "lint", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, - {As: "periodic-unit", Cron: utilpointer.String(cron), ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, + {As: "periodic-unit", DisableRehearsal: true, Cron: utilpointer.String(cron), ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, {As: "periodic-lint", Cron: utilpointer.String(cron), ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{ - Config: config.Prowgen{Rehearsals: config.Rehearsals{DisabledRehearsals: []string{"unit", "periodic-unit"}}}, - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }}, + repoInfo: &ciop.Metadata{ + Org: "organization", + Repo: "repository", + Branch: "branch", + }, }, { id: "disabled rehearsals at repo level", config: &ciop.ReleaseBuildConfiguration{ + Prowgen: &ciop.ProwgenOverrides{DisableRehearsals: true}, Tests: []ciop.TestStepConfiguration{ {As: "unit", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, {As: "periodic-unit", Cron: utilpointer.String(cron), ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{ - Config: config.Prowgen{Rehearsals: config.Rehearsals{DisableAll: true}}, - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }}, + repoInfo: &ciop.Metadata{ + Org: "organization", + Repo: "repository", + Branch: "branch", + }, }, { id: "ci-operator config overrides prowgen rehearsals", @@ -729,27 +724,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, - }, - { - id: "ci-operator config takes precedence over prowgen config", - config: &ciop.ReleaseBuildConfiguration{ - Prowgen: &ciop.ProwgenOverrides{DisableRehearsals: true}, - Tests: []ciop.TestStepConfiguration{ - {As: "unit", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, - }, }, - repoInfo: &ProwgenInfo{ - Config: config.Prowgen{Rehearsals: config.Rehearsals{DisableAll: false}}, - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }}, }, { id: "per-test disable rehearsal from ci-operator config", @@ -759,11 +738,11 @@ func TestGenerateJobs(t *testing.T) { {As: "lint", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "multiarch postsubmit images", @@ -782,12 +761,10 @@ func TestGenerateJobs(t *testing.T) { }}, PromotionConfiguration: &ciop.PromotionConfiguration{}, }, - repoInfo: &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }, + repoInfo: &ciop.Metadata{ + Org: "organization", + Repo: "repository", + Branch: "branch", }, }, { @@ -807,12 +784,10 @@ func TestGenerateJobs(t *testing.T) { }}, PromotionConfiguration: &ciop.PromotionConfiguration{}, }, - repoInfo: &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }, + repoInfo: &ciop.Metadata{ + Org: "organization", + Repo: "repository", + Branch: "branch", }, }, { @@ -828,12 +803,10 @@ func TestGenerateJobs(t *testing.T) { }}, PromotionConfiguration: &ciop.PromotionConfiguration{}, }, - repoInfo: &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }, + repoInfo: &ciop.Metadata{ + Org: "organization", + Repo: "repository", + Branch: "branch", }, }, { @@ -846,36 +819,10 @@ func TestGenerateJobs(t *testing.T) { }, }, }, - repoInfo: &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }, - }, - }, - { - id: "images job is configured for slack reporting", - config: &ciop.ReleaseBuildConfiguration{ - Images: ciop.ImageConfiguration{Items: []ciop.ProjectDirectoryImageBuildStepConfiguration{{}}}, - PromotionConfiguration: &ciop.PromotionConfiguration{}, - }, - repoInfo: &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "organization", - Repo: "repository", - Branch: "branch", - }, - Config: config.Prowgen{ - SlackReporterConfigs: []config.SlackReporterConfig{ - { - Channel: "some-channel", - JobStatesToReport: []prowv1.ProwJobState{"error"}, - ReportTemplate: "some template", - JobNames: []string{"images", "e2e"}, - }, - }, - }, + repoInfo: &ciop.Metadata{ + Org: "organization", + Repo: "repository", + Branch: "branch", }, }, { @@ -885,11 +832,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", Capabilities: []string{"intranet"}, Cron: utilpointer.String(cron), ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "periodic/presubmit with capabilities", @@ -898,11 +845,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", Capabilities: []string{"intranet", "arm64", "rce", "sshd-bastion"}, Cron: utilpointer.String(cron), Presubmit: true, ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, // rce - release-controller-eligible, sshd-bastion - for multiarch P/Z libvirt jobs }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "sharded presubmit", @@ -911,11 +858,11 @@ func TestGenerateJobs(t *testing.T) { {As: "unit", ShardCount: intPointer(3), ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "bin"}}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "images job with skip_if_only_changed propagated to presubmit", @@ -926,11 +873,11 @@ func TestGenerateJobs(t *testing.T) { }, PromotionConfiguration: &ciop.PromotionConfiguration{}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "images job with run_if_changed propagated to presubmit", @@ -941,11 +888,11 @@ func TestGenerateJobs(t *testing.T) { }, PromotionConfiguration: &ciop.PromotionConfiguration{}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "images job with pipeline_skip_if_only_changed propagated to presubmit only", @@ -956,11 +903,11 @@ func TestGenerateJobs(t *testing.T) { }, PromotionConfiguration: &ciop.PromotionConfiguration{}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "postsubmit with max_concurrency from test config", @@ -969,11 +916,11 @@ func TestGenerateJobs(t *testing.T) { {As: "derTest", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "from"}}, {As: "leTest", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "from"}, Postsubmit: true, MaxConcurrency: 6}}, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, { id: "periodic with max_concurrency from test config", @@ -982,11 +929,11 @@ func TestGenerateJobs(t *testing.T) { {As: "derTest", ContainerTestConfiguration: &ciop.ContainerTestConfiguration{From: "from"}, Cron: utilpointer.String(cron), MaxConcurrency: 3}, }, }, - repoInfo: &ProwgenInfo{Metadata: ciop.Metadata{ + repoInfo: &ciop.Metadata{ Org: "organization", Repo: "repository", Branch: "branch", - }}, + }, }, } @@ -1105,12 +1052,10 @@ func TestBundleWithCapabilities(t *testing.T) { Bundles: []ciop.Bundle{tc.bundle}, }, } - repoInfo := &ProwgenInfo{ - Metadata: ciop.Metadata{ - Org: "test-org", - Repo: "test-repo", - Branch: "main", - }, + repoInfo := &ciop.Metadata{ + Org: "test-org", + Repo: "test-repo", + Branch: "main", } jobConfig, err := GenerateJobs(config, repoInfo) diff --git a/pkg/prowgen/testdata/zz_fixture_TestGenerateJobs_ci_operator_config_takes_precedence_over_prowgen_config.yaml b/pkg/prowgen/testdata/zz_fixture_TestGenerateJobs_ci_operator_config_takes_precedence_over_prowgen_config.yaml deleted file mode 100644 index 6ac0dc78d53..00000000000 --- a/pkg/prowgen/testdata/zz_fixture_TestGenerateJobs_ci_operator_config_takes_precedence_over_prowgen_config.yaml +++ /dev/null @@ -1,4 +0,0 @@ -presubmits: - organization/repository: - - always_run: false - name: pull-ci-organization-repository-branch-unit diff --git a/pkg/prowgen/testdata/zz_fixture_TestGenerateJobs_images_job_is_configured_for_slack_reporting.yaml b/pkg/prowgen/testdata/zz_fixture_TestGenerateJobs_images_job_is_configured_for_slack_reporting.yaml deleted file mode 100644 index 8b5fa5136df..00000000000 --- a/pkg/prowgen/testdata/zz_fixture_TestGenerateJobs_images_job_is_configured_for_slack_reporting.yaml +++ /dev/null @@ -1,25 +0,0 @@ -postsubmits: - organization/repository: - - always_run: true - labels: - ci-operator.openshift.io/is-promotion: "true" - max_concurrency: 1 - name: branch-ci-organization-repository-branch-images - reporter_config: - slack: - channel: some-channel - job_states_to_report: - - error - report_template: some template -presubmits: - organization/repository: - - always_run: false - labels: - pj-rehearse.openshift.io/can-be-rehearsed: "true" - name: pull-ci-organization-repository-branch-images - reporter_config: - slack: - channel: some-channel - job_states_to_report: - - error - report_template: some template diff --git a/pkg/prowgen/testdata/zz_fixture_TestNewProwJobBaseBuilderForTest_job_excluded_by_patterns_should_not_have_slack_reporter_config.yaml b/pkg/prowgen/testdata/zz_fixture_TestNewProwJobBaseBuilderForTest_job_excluded_by_patterns_should_not_have_slack_reporter_config.yaml deleted file mode 100644 index 40aff4aa323..00000000000 --- a/pkg/prowgen/testdata/zz_fixture_TestNewProwJobBaseBuilderForTest_job_excluded_by_patterns_should_not_have_slack_reporter_config.yaml +++ /dev/null @@ -1,52 +0,0 @@ -agent: kubernetes -decorate: true -decoration_config: - skip_cloning: true -name: prefix-ci-o-r-b-unit-skip -spec: - containers: - - args: - - --gcs-upload-secret=/secrets/gcs/service-account.json - - --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson - - --report-credentials-file=/etc/report/credentials - - --target=unit-skip - command: - - ci-operator - env: - - name: HTTP_SERVER_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest - imagePullPolicy: Always - name: "" - ports: - - containerPort: 8080 - name: http - resources: - requests: - cpu: 10m - volumeMounts: - - mountPath: /secrets/gcs - name: gcs-credentials - readOnly: true - - mountPath: /secrets/manifest-tool - name: manifest-tool-local-pusher - readOnly: true - - mountPath: /etc/pull-secret - name: pull-secret - readOnly: true - - mountPath: /etc/report - name: result-aggregator - readOnly: true - serviceAccountName: ci-operator - volumes: - - name: manifest-tool-local-pusher - secret: - secretName: manifest-tool-local-pusher - - name: pull-secret - secret: - secretName: registry-pull-credentials - - name: result-aggregator - secret: - secretName: result-aggregator diff --git a/test/integration/ci-operator-prowgen/input/config/norehearsals/duper/.config.prowgen b/test/integration/ci-operator-prowgen/input/config/norehearsals/duper/.config.prowgen deleted file mode 100644 index 23beb2ccb99..00000000000 --- a/test/integration/ci-operator-prowgen/input/config/norehearsals/duper/.config.prowgen +++ /dev/null @@ -1,2 +0,0 @@ -rehearsals: - disable_all: true diff --git a/test/integration/ci-operator-prowgen/input/config/norehearsals/duper/norehearsals-duper-master.yaml b/test/integration/ci-operator-prowgen/input/config/norehearsals/duper/norehearsals-duper-master.yaml index 8937b95a017..f5d629ba698 100644 --- a/test/integration/ci-operator-prowgen/input/config/norehearsals/duper/norehearsals-duper-master.yaml +++ b/test/integration/ci-operator-prowgen/input/config/norehearsals/duper/norehearsals-duper-master.yaml @@ -1,3 +1,5 @@ +prowgen: + disable_rehearsals: true base_images: base: name: origin-v4.0 diff --git a/test/integration/ci-operator-prowgen/input/config/norehearsals/stuper/.config.prowgen b/test/integration/ci-operator-prowgen/input/config/norehearsals/stuper/.config.prowgen deleted file mode 100644 index 459853821d2..00000000000 --- a/test/integration/ci-operator-prowgen/input/config/norehearsals/stuper/.config.prowgen +++ /dev/null @@ -1,3 +0,0 @@ -rehearsals: - disabled_rehearsals: - - unit diff --git a/test/integration/ci-operator-prowgen/input/config/norehearsals/stuper/norehearsals-stuper-master.yaml b/test/integration/ci-operator-prowgen/input/config/norehearsals/stuper/norehearsals-stuper-master.yaml index 32ca240f3d7..7bb313b0b01 100644 --- a/test/integration/ci-operator-prowgen/input/config/norehearsals/stuper/norehearsals-stuper-master.yaml +++ b/test/integration/ci-operator-prowgen/input/config/norehearsals/stuper/norehearsals-stuper-master.yaml @@ -22,6 +22,7 @@ tests: commands: make test-unit container: from: src + disable_rehearsal: true - as: upload-results commands: make upload-results container: diff --git a/test/integration/ci-operator-prowgen/input/config/private-org/.config.prowgen b/test/integration/ci-operator-prowgen/input/config/private-org/.config.prowgen deleted file mode 100644 index 4eb57c8eba7..00000000000 --- a/test/integration/ci-operator-prowgen/input/config/private-org/.config.prowgen +++ /dev/null @@ -1 +0,0 @@ -private: true \ No newline at end of file diff --git a/test/integration/ci-operator-prowgen/input/config/private-org/duper/private-org-duper-master.yaml b/test/integration/ci-operator-prowgen/input/config/private-org/duper/private-org-duper-master.yaml index e1eddf3170f..4c2923186b1 100644 --- a/test/integration/ci-operator-prowgen/input/config/private-org/duper/private-org-duper-master.yaml +++ b/test/integration/ci-operator-prowgen/input/config/private-org/duper/private-org-duper-master.yaml @@ -1,3 +1,5 @@ +prowgen: + private: true build_root: image_stream_tag: name: release diff --git a/test/integration/ci-operator-prowgen/input/config/private-org/super/private-org-super-master.yaml b/test/integration/ci-operator-prowgen/input/config/private-org/super/private-org-super-master.yaml index 8456c120da4..8bb1332e323 100644 --- a/test/integration/ci-operator-prowgen/input/config/private-org/super/private-org-super-master.yaml +++ b/test/integration/ci-operator-prowgen/input/config/private-org/super/private-org-super-master.yaml @@ -1,3 +1,5 @@ +prowgen: + private: true build_root: from_repository: true resources: diff --git a/test/integration/ci-operator-prowgen/input/config/private/duper/.config.prowgen b/test/integration/ci-operator-prowgen/input/config/private/duper/.config.prowgen deleted file mode 100644 index 4eb57c8eba7..00000000000 --- a/test/integration/ci-operator-prowgen/input/config/private/duper/.config.prowgen +++ /dev/null @@ -1 +0,0 @@ -private: true \ No newline at end of file diff --git a/test/integration/ci-operator-prowgen/input/config/private/duper/private-duper-master.yaml b/test/integration/ci-operator-prowgen/input/config/private/duper/private-duper-master.yaml index ba94b848353..2fa81e2df9e 100644 --- a/test/integration/ci-operator-prowgen/input/config/private/duper/private-duper-master.yaml +++ b/test/integration/ci-operator-prowgen/input/config/private/duper/private-duper-master.yaml @@ -1,3 +1,5 @@ +prowgen: + private: true base_images: base: name: origin-v4.0 diff --git a/test/integration/ci-operator-prowgen/input/config/slack-report/duper/.config.prowgen b/test/integration/ci-operator-prowgen/input/config/slack-report/duper/.config.prowgen deleted file mode 100644 index 9bf89dd9f08..00000000000 --- a/test/integration/ci-operator-prowgen/input/config/slack-report/duper/.config.prowgen +++ /dev/null @@ -1,16 +0,0 @@ -slack_reporter: -- channel: "#slack-channel" - job_states_to_report: - - success - - failure - - error - report_template: '{{if eq .Status.State "success"}} :rainbow: Job *{{.Spec.Job}}* - ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> :rainbow: {{else}} - :volcano: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View - logs> :volcano: {{end}}' - job_names: - - unit - - upload-results - - lint - excluded_variants: - - exclude diff --git a/test/integration/ci-operator-prowgen/input/config/slack-report/duper/slack-report-duper-master.yaml b/test/integration/ci-operator-prowgen/input/config/slack-report/duper/slack-report-duper-master.yaml index 9ef9e3efa73..c013ac81e62 100644 --- a/test/integration/ci-operator-prowgen/input/config/slack-report/duper/slack-report-duper-master.yaml +++ b/test/integration/ci-operator-prowgen/input/config/slack-report/duper/slack-report-duper-master.yaml @@ -22,6 +22,16 @@ tests: commands: make test-unit container: from: src + reporter_config: + channel: '#slack-channel' + job_states_to_report: + - success + - failure + - error + report_template: '{{if eq .Status.State "success"}} :rainbow: Job *{{.Spec.Job}}* + ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> :rainbow: {{else}} + :volcano: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View + logs> :volcano: {{end}}' - as: e2e commands: make test-e2e container: @@ -31,11 +41,31 @@ tests: container: from: src postsubmit: true + reporter_config: + channel: '#slack-channel' + job_states_to_report: + - success + - failure + - error + report_template: '{{if eq .Status.State "success"}} :rainbow: Job *{{.Spec.Job}}* + ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> :rainbow: {{else}} + :volcano: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View + logs> :volcano: {{end}}' - as: lint commands: make test-lint container: from: src interval: 2h + reporter_config: + channel: '#slack-channel' + job_states_to_report: + - success + - failure + - error + report_template: '{{if eq .Status.State "success"}} :rainbow: Job *{{.Spec.Job}}* + ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> :rainbow: {{else}} + :volcano: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View + logs> :volcano: {{end}}' zz_generated_metadata: branch: master org: slack-report diff --git a/test/integration/ci-operator-prowgen/input/config/super/duper/.config.prowgen b/test/integration/ci-operator-prowgen/input/config/super/duper/.config.prowgen deleted file mode 100644 index 3047b3f8609..00000000000 --- a/test/integration/ci-operator-prowgen/input/config/super/duper/.config.prowgen +++ /dev/null @@ -1,3 +0,0 @@ -skip_operator_presubmits: -- branch: release-4.19 - variant: periodics diff --git a/test/integration/ci-operator-prowgen/input/config/super/duper/super-duper-release-4.19__periodics.yaml b/test/integration/ci-operator-prowgen/input/config/super/duper/super-duper-release-4.19__periodics.yaml index 93e75b1db42..71fa2e2ce4b 100644 --- a/test/integration/ci-operator-prowgen/input/config/super/duper/super-duper-release-4.19__periodics.yaml +++ b/test/integration/ci-operator-prowgen/input/config/super/duper/super-duper-release-4.19__periodics.yaml @@ -1,3 +1,5 @@ +prowgen: + skip_operator_presubmits: true base_images: base: name: "4.19"