diff --git a/cmd/pj-rehearse/main.go b/cmd/pj-rehearse/main.go index 748311c7..d2ad9cd1 100644 --- a/cmd/pj-rehearse/main.go +++ b/cmd/pj-rehearse/main.go @@ -163,11 +163,9 @@ func main() { } // We can only detect changes if we managed to load both ci-operator config versions + changedCiopConfigs := config.CompoundCiopConfig{} if masterConfig.CiOperator != nil && prConfig.CiOperator != nil { - changedCiopConfigs := diffs.GetChangedCiopConfigs(masterConfig.CiOperator, prConfig.CiOperator, logger) - for name := range changedCiopConfigs { - logger.WithField("ciop-config", name).Info("Changed ci-operator config") - } + changedCiopConfigs = diffs.GetChangedCiopConfigs(masterConfig.CiOperator, prConfig.CiOperator, logger) } // We can only detect changes if we managed to load both CI template versions @@ -201,8 +199,10 @@ func main() { } loggers := rehearse.Loggers{Job: logger, Debug: debugLogger.WithField(prowgithub.PrLogField, prNumber)} - changedPresubmits := diffs.GetChangedPresubmits(masterConfig.Prow, prConfig.Prow, logger) - rehearsals := rehearse.ConfigureRehearsalJobs(changedPresubmits, prConfig.CiOperator, prNumber, loggers, o.allowVolumes) + toRehearse := diffs.GetChangedPresubmits(masterConfig.Prow, prConfig.Prow, logger) + toRehearse.AddAll(diffs.GetPresubmitsForCiopConfigs(prConfig.Prow, changedCiopConfigs, logger)) + + rehearsals := rehearse.ConfigureRehearsalJobs(toRehearse, prConfig.CiOperator, prNumber, loggers, o.allowVolumes) if len(rehearsals) == 0 { logger.Info("no jobs to rehearse have been found") os.Exit(0) diff --git a/cmd/pj-rehearse/main_test.go b/cmd/pj-rehearse/main_test.go index ac09089b..3f9eb7f6 100644 --- a/cmd/pj-rehearse/main_test.go +++ b/cmd/pj-rehearse/main_test.go @@ -131,6 +131,7 @@ func getRehersalsHelper(logger *logrus.Entry, prNumber int) ([]*prowconfig.Presu candidateConfigPath := filepath.Join(candidatePath, config.ConfigInRepoPath) candidateJobConfigPath := filepath.Join(candidatePath, config.JobConfigInRepoPath) candidateCiopConfigPath := filepath.Join(candidatePath, config.CiopConfigInRepoPath) + masterCiopConfigPath := filepath.Join(masterPath, config.CiopConfigInRepoPath) masterConfigPath := filepath.Join(masterPath, config.ConfigInRepoPath) masterJobConfigPath := filepath.Join(masterPath, config.JobConfigInRepoPath) @@ -146,12 +147,19 @@ func getRehersalsHelper(logger *logrus.Entry, prNumber int) ([]*prowconfig.Presu if err != nil { return nil, fmt.Errorf("failed to load ci-operator config: %v", err) } + ciopMasterConfig, err := config.CompoundLoad(masterCiopConfigPath) + if err != nil { + return nil, fmt.Errorf("failed to load ci-operator config: %v", err) + } changedPresubmits := diffs.GetChangedPresubmits(prowConfig, prowPRConfig, logger) if len(changedPresubmits) == 0 { return nil, fmt.Errorf("Empty changedPresubmits was not expected") } + changedCiopConfigs := diffs.GetChangedCiopConfigs(ciopMasterConfig, ciopPrConfig, logger) + changedPresubmits.AddAll(diffs.GetPresubmitsForCiopConfigs(prowPRConfig, changedCiopConfigs, logger)) + rehearsals := rehearse.ConfigureRehearsalJobs(changedPresubmits, ciopPrConfig, prNumber, rehearse.Loggers{Job: logger, Debug: logger}, false) return rehearsals, nil } diff --git a/pkg/config/jobs.go b/pkg/config/jobs.go new file mode 100644 index 00000000..f1fd6a9a --- /dev/null +++ b/pkg/config/jobs.go @@ -0,0 +1,36 @@ +package config + +import ( + prowconfig "k8s.io/test-infra/prow/config" +) + +type Presubmits map[string][]prowconfig.Presubmit + +// AddAll adds all jobs from a different instance. +// The method assumes two jobs with a matching name for the same repository +// are identical, so so if a presubmit with a given name already exists, it +// is kept as is. +func (p Presubmits) AddAll(jobs Presubmits) { + for repo := range jobs { + if _, ok := p[repo]; !ok { + p[repo] = []prowconfig.Presubmit{} + } + + for _, sourceJob := range jobs[repo] { + p.Add(repo, sourceJob) + } + } +} + +// Add a presubmit for a given repo. +// The method assumes two jobs with a matching name are identical, so if +// a presubmit with a given name already exists, it is kept as is. +func (p Presubmits) Add(repo string, job prowconfig.Presubmit) { + for _, destJob := range p[repo] { + if destJob.Name == job.Name { + return + } + } + + p[repo] = append(p[repo], job) +} diff --git a/pkg/config/jobs_test.go b/pkg/config/jobs_test.go new file mode 100644 index 00000000..913d1a88 --- /dev/null +++ b/pkg/config/jobs_test.go @@ -0,0 +1,118 @@ +package config + +import ( + "k8s.io/apimachinery/pkg/util/diff" + "reflect" + "testing" + + prowconfig "k8s.io/test-infra/prow/config" +) + +func TestPresubmitsAddAll(t *testing.T) { + testCases := []struct { + description string + source Presubmits + destination Presubmits + expected Presubmits + }{{ + description: "merge empty structure into empty structure", + }, { + description: "merge empty structure into non-empty structure", + source: Presubmits{}, + destination: Presubmits{"org/repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "destination-job-for-org-repo"}}, + }}, + expected: Presubmits{"org/repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "destination-job-for-org-repo"}}, + }}, + }, { + description: "merge non-empty structure into empty structure", + source: Presubmits{"org/repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "source-job-for-org-repo"}}, + }}, + destination: Presubmits{}, + expected: Presubmits{"org/repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "source-job-for-org-repo"}}, + }}, + }, { + description: "merge different jobs for a single repo, result should have both", + source: Presubmits{"org/repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "source-job-for-org-repo"}}, + }}, + destination: Presubmits{"org/repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "destination-job-for-org-repo"}}}}, + expected: Presubmits{"org/repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "destination-job-for-org-repo"}}, + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "source-job-for-org-repo"}}, + }}, + }, { + description: "merge jobs for different repos, result should have both", + source: Presubmits{"org/source-repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "source-job-for-org-source-repo"}}, + }}, + destination: Presubmits{"org/destination-repo": { + prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "destination-job-for-org-destination-repo"}}}}, + expected: Presubmits{ + "org/source-repo": {prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "source-job-for-org-source-repo"}}}, + "org/destination-repo": {prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "destination-job-for-org-destination-repo"}}}, + }, + }, { + description: "merge jobs with same name for a single repo, result has the one originally in destination", + source: Presubmits{"org/repo": { + prowconfig.Presubmit{ + JobBase: prowconfig.JobBase{Name: "same-job-for-org-repo"}, + AlwaysRun: true, + }, + }}, + destination: Presubmits{"org/repo": { + prowconfig.Presubmit{ + JobBase: prowconfig.JobBase{Name: "same-job-for-org-repo"}, + AlwaysRun: false, + }}}, + expected: Presubmits{"org/repo": { + prowconfig.Presubmit{ + JobBase: prowconfig.JobBase{Name: "same-job-for-org-repo"}, + AlwaysRun: false, + }, + }}, + }, + } + + for _, tc := range testCases { + t.Run(tc.description, func(t *testing.T) { + tc.destination.AddAll(tc.source) + + if !reflect.DeepEqual(tc.destination, tc.expected) { + t.Errorf("Presubmits differ from expected after AddAll:\n%s", diff.ObjectDiff(tc.expected, tc.destination)) + } + }) + } +} + +func TestPresubmitsAdd(t *testing.T) { + testCases := []struct { + description string + presubmits Presubmits + repo string + job prowconfig.Presubmit + expected Presubmits + }{{ + description: "add job to new repo", + presubmits: Presubmits{}, + repo: "org/repo", + job: prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "job-for-org-repo"}}, + expected: Presubmits{"org/repo": {prowconfig.Presubmit{JobBase: prowconfig.JobBase{Name: "job-for-org-repo"}}}}, + }, + } + + for _, tc := range testCases { + t.Run(tc.description, func(t *testing.T) { + tc.presubmits.Add(tc.repo, tc.job) + + if !reflect.DeepEqual(tc.expected, tc.presubmits) { + t.Errorf("Presubmits differ from expected after Add:\n%s", diff.ObjectDiff(tc.expected, tc.presubmits)) + } + }) + } + +} diff --git a/pkg/config/release.go b/pkg/config/release.go index 5cc9c0fd..ca78392a 100644 --- a/pkg/config/release.go +++ b/pkg/config/release.go @@ -22,6 +22,8 @@ const ( CiopConfigInRepoPath = "ci-operator/config" // TemplatesPath is the path of the templates from release repo TemplatesPath = "ci-operator/templates" + // Name of the configmap that stores all ci-operator configs + CiOperatorConfigsCMName = "ci-operator-configs" ) // ReleaseRepoConfig contains all configuration present in release repo (usually openshift/release) diff --git a/pkg/diffs/diffs.go b/pkg/diffs/diffs.go index bb05f350..39a2db89 100644 --- a/pkg/diffs/diffs.go +++ b/pkg/diffs/diffs.go @@ -63,8 +63,8 @@ func GetChangedCiopConfigs(masterConfig, prConfig config.CompoundCiopConfig, log } // GetChangedPresubmits returns a mapping of repo to presubmits to execute. -func GetChangedPresubmits(prowMasterConfig, prowPRConfig *prowconfig.Config, logger *logrus.Entry) map[string][]prowconfig.Presubmit { - ret := make(map[string][]prowconfig.Presubmit) +func GetChangedPresubmits(prowMasterConfig, prowPRConfig *prowconfig.Config, logger *logrus.Entry) config.Presubmits { + ret := config.Presubmits{} masterJobs := getJobsByRepoAndName(prowMasterConfig.JobConfig.Presubmits) for repo, jobs := range prowPRConfig.JobConfig.Presubmits { @@ -77,14 +77,14 @@ func GetChangedPresubmits(prowMasterConfig, prowPRConfig *prowconfig.Config, log if masterJob.Agent != job.Agent { logFields[logDiffs] = convertToReadableDiff(masterJob.Agent, job.Agent, objectAgent) logger.WithFields(logFields).Info(chosenJob) - ret[repo] = append(ret[repo], job) + ret.Add(repo, job) continue } if !equality.Semantic.DeepEqual(masterJob.Spec, job.Spec) { logFields[logDiffs] = convertToReadableDiff(masterJob.Spec, job.Spec, objectSpec) logger.WithFields(logFields).Info(chosenJob) - ret[repo] = append(ret[repo], job) + ret.Add(repo, job) } } } @@ -96,7 +96,7 @@ func GetChangedPresubmits(prowMasterConfig, prowPRConfig *prowconfig.Config, log // and compare the same key and index of the other map of slices, // we convert them as `repo-> jobName-> Presubmit` to be able to // access any specific elements of the Presubmits without the need to iterate in slices. -func getJobsByRepoAndName(presubmits map[string][]prowconfig.Presubmit) map[string]map[string]prowconfig.Presubmit { +func getJobsByRepoAndName(presubmits config.Presubmits) map[string]map[string]prowconfig.Presubmit { jobsByRepo := make(map[string]map[string]prowconfig.Presubmit) for repo, preSubmitList := range presubmits { @@ -150,3 +150,30 @@ func GetChangedTemplates(masterTemplates, prTemplates map[string]*templateapi.Te } return changedTemplates } + +func GetPresubmitsForCiopConfigs(prowConfig *prowconfig.Config, ciopConfigs config.CompoundCiopConfig, logger *logrus.Entry) config.Presubmits { + ret := config.Presubmits{} + + for repo, jobs := range prowConfig.JobConfig.Presubmits { + for _, job := range jobs { + if job.Agent != string(pjapi.KubernetesAgent) { + continue + } + for _, env := range job.Spec.Containers[0].Env { + if env.ValueFrom == nil { + continue + } + if env.ValueFrom.ConfigMapKeyRef == nil { + continue + } + if env.ValueFrom.ConfigMapKeyRef.Name == config.CiOperatorConfigsCMName { + if _, ok := ciopConfigs[env.ValueFrom.ConfigMapKeyRef.Key]; ok { + ret.Add(repo, job) + } + } + } + } + } + + return ret +} diff --git a/pkg/diffs/diffs_test.go b/pkg/diffs/diffs_test.go index 5d1fb23f..0b8c968a 100644 --- a/pkg/diffs/diffs_test.go +++ b/pkg/diffs/diffs_test.go @@ -14,6 +14,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/diff" + pjapi "k8s.io/test-infra/prow/apis/prowjobs/v1" prowconfig "k8s.io/test-infra/prow/config" templateapi "github.com/openshift/api/template/v1" @@ -111,14 +112,14 @@ func TestGetChangedPresubmits(t *testing.T) { testCases := []struct { name string configGenerator func() (before, after *prowconfig.Config) - expected map[string][]prowconfig.Presubmit + expected config.Presubmits }{ { name: "no differences mean nothing is identified as a diff", configGenerator: func() (*prowconfig.Config, *prowconfig.Config) { return makeConfig(basePresubmit), makeConfig(basePresubmit) }, - expected: map[string][]prowconfig.Presubmit{}, + expected: config.Presubmits{}, }, { name: "new job added", @@ -134,7 +135,7 @@ func TestGetChangedPresubmits(t *testing.T) { return makeConfig(basePresubmit), makeConfig(p) }, - expected: map[string][]prowconfig.Presubmit{ + expected: config.Presubmits{ "org/repo": func() []prowconfig.Presubmit { var p []prowconfig.Presubmit var pNew prowconfig.Presubmit @@ -155,7 +156,7 @@ func TestGetChangedPresubmits(t *testing.T) { return makeConfig(p), makeConfig(basePresubmit) }, - expected: map[string][]prowconfig.Presubmit{ + expected: config.Presubmits{ "org/repo": basePresubmit, }, }, @@ -168,7 +169,7 @@ func TestGetChangedPresubmits(t *testing.T) { return makeConfig(basePresubmit), makeConfig(p) }, - expected: map[string][]prowconfig.Presubmit{ + expected: config.Presubmits{ "org/repo": func() []prowconfig.Presubmit { var p []prowconfig.Presubmit deepcopy.Copy(&p, basePresubmit) @@ -192,7 +193,7 @@ func TestGetChangedPresubmits(t *testing.T) { } return makeConfig(basePresubmit), makeConfig(p) }, - expected: map[string][]prowconfig.Presubmit{ + expected: config.Presubmits{ "org/repo": func() []prowconfig.Presubmit { var p []prowconfig.Presubmit deepcopy.Copy(&p, basePresubmit) @@ -223,7 +224,7 @@ func TestGetChangedPresubmits(t *testing.T) { func makeConfig(p []prowconfig.Presubmit) *prowconfig.Config { return &prowconfig.Config{ JobConfig: prowconfig.JobConfig{ - Presubmits: map[string][]prowconfig.Presubmit{"org/repo": p}, + Presubmits: config.Presubmits{"org/repo": p}, }, } } @@ -396,3 +397,105 @@ func makeBaseTemplates(baseParameters []templateapi.Parameter, baseObjects []run }, } } + +func TestGetPresubmitsForCiopConfigs(t *testing.T) { + basePresubmitWithCiop := prowconfig.Presubmit{ + JobBase: prowconfig.JobBase{ + Agent: string(pjapi.KubernetesAgent), + Spec: &v1.PodSpec{ + Containers: []v1.Container{{ + Env: []v1.EnvVar{{ + ValueFrom: &v1.EnvVarSource{ + ConfigMapKeyRef: &v1.ConfigMapKeySelector{ + LocalObjectReference: v1.LocalObjectReference{ + Name: config.CiOperatorConfigsCMName, + }, + }, + }, + }}, + }}, + }, + }, + } + + testCases := []struct { + description string + prow *prowconfig.Config + ciop config.CompoundCiopConfig + expected config.Presubmits + }{{ + description: "return a presubmit using one of the input ciop configs", + prow: &prowconfig.Config{ + JobConfig: prowconfig.JobConfig{ + Presubmits: map[string][]prowconfig.Presubmit{ + "org/repo": { + func() prowconfig.Presubmit { + ret := prowconfig.Presubmit{} + deepcopy.Copy(&ret, &basePresubmitWithCiop) + ret.Name = "job-for-org-repo" + ret.Spec.Containers[0].Env[0].ValueFrom.ConfigMapKeyRef.Key = "org-repo-branch.yaml" + return ret + }(), + }}, + }, + }, + ciop: config.CompoundCiopConfig{"org-repo-branch.yaml": &cioperatorapi.ReleaseBuildConfiguration{}}, + expected: config.Presubmits{"org/repo": { + func() prowconfig.Presubmit { + ret := prowconfig.Presubmit{} + deepcopy.Copy(&ret, &basePresubmitWithCiop) + ret.Name = "job-for-org-repo" + ret.Spec.Containers[0].Env[0].ValueFrom.ConfigMapKeyRef.Key = "org-repo-branch.yaml" + return ret + }(), + }}, + }, { + description: "do not return a presubmit using a ciop config not present in input", + prow: &prowconfig.Config{ + JobConfig: prowconfig.JobConfig{ + Presubmits: map[string][]prowconfig.Presubmit{ + "org/repo": { + func() prowconfig.Presubmit { + ret := prowconfig.Presubmit{} + deepcopy.Copy(&ret, &basePresubmitWithCiop) + ret.Name = "job-for-org-repo" + ret.Spec.Containers[0].Env[0].ValueFrom.ConfigMapKeyRef.Key = "org-repo-branch.yaml" + return ret + }(), + }}, + }, + }, + ciop: config.CompoundCiopConfig{}, + expected: config.Presubmits{}, + }, { + description: "handle jenkins presubmits", + prow: &prowconfig.Config{ + JobConfig: prowconfig.JobConfig{ + Presubmits: map[string][]prowconfig.Presubmit{ + "org/repo": { + func() prowconfig.Presubmit { + ret := prowconfig.Presubmit{} + deepcopy.Copy(&ret, &basePresubmitWithCiop) + ret.Name = "job-for-org-repo" + ret.Agent = string(pjapi.JenkinsAgent) + ret.Spec.Containers[0].Env = []v1.EnvVar{} + return ret + }(), + }}, + }, + }, + ciop: config.CompoundCiopConfig{}, + expected: config.Presubmits{}, + }, + } + + for _, tc := range testCases { + t.Run(tc.description, func(t *testing.T) { + presubmits := GetPresubmitsForCiopConfigs(tc.prow, tc.ciop, logrus.NewEntry(logrus.New())) + + if !reflect.DeepEqual(tc.expected, presubmits) { + t.Errorf("Returned presubmits differ from expected:\n%s", diff.ObjectDiff(tc.expected, presubmits)) + } + }) + } +} diff --git a/pkg/rehearse/jobs.go b/pkg/rehearse/jobs.go index 40b680de..c30e6dcc 100644 --- a/pkg/rehearse/jobs.go +++ b/pkg/rehearse/jobs.go @@ -30,8 +30,6 @@ import ( const ( rehearseLabel = "ci.openshift.org/rehearse" defaultRehearsalRerunCommand = "/test pj-rehearse" - ciOperatorConfigsCMName = "ci-operator-configs" - ciopConfigsInRepo = "ci-operator/config" logRehearsalJob = "rehearsal-job" logCiopConfigFile = "ciop-config-file" logCiopConfigRepo = "ciop-config-repo" @@ -78,8 +76,8 @@ func makeRehearsalPresubmit(source *prowconfig.Presubmit, repo string, prNumber return &rehearsal, nil } -func filterJobs(changedPresubmits map[string][]prowconfig.Presubmit, allowVolumes bool, logger logrus.FieldLogger) map[string][]prowconfig.Presubmit { - ret := make(map[string][]prowconfig.Presubmit) +func filterJobs(changedPresubmits map[string][]prowconfig.Presubmit, allowVolumes bool, logger logrus.FieldLogger) config.Presubmits { + ret := config.Presubmits{} for repo, jobs := range changedPresubmits { for _, job := range jobs { jobLogger := logger.WithFields(logrus.Fields{"repo": repo, "job": job.Name}) @@ -87,7 +85,7 @@ func filterJobs(changedPresubmits map[string][]prowconfig.Presubmit, allowVolume jobLogger.WithError(err).Warn("could not rehearse job") continue } - ret[repo] = append(ret[repo], job) + ret.Add(repo, job) } } return ret @@ -138,7 +136,7 @@ func inlineCiOpConfig(job *prowconfig.Presubmit, targetRepo string, ciopConfigs if env.ValueFrom.ConfigMapKeyRef == nil { continue } - if env.ValueFrom.ConfigMapKeyRef.Name == ciOperatorConfigsCMName { + if env.ValueFrom.ConfigMapKeyRef.Name == config.CiOperatorConfigsCMName { filename := env.ValueFrom.ConfigMapKeyRef.Key logFields := logrus.Fields{logCiopConfigFile: filename, logCiopConfigRepo: targetRepo, logRehearsalJob: job.Name} @@ -166,7 +164,7 @@ func inlineCiOpConfig(job *prowconfig.Presubmit, targetRepo string, ciopConfigs // ConfigureRehearsalJobs filters the jobs that should be rehearsed, then return a list of them re-configured with the // ci-operator's configuration inlined. -func ConfigureRehearsalJobs(toBeRehearsed map[string][]prowconfig.Presubmit, ciopConfigs config.CompoundCiopConfig, prNumber int, loggers Loggers, allowVolumes bool) []*prowconfig.Presubmit { +func ConfigureRehearsalJobs(toBeRehearsed config.Presubmits, ciopConfigs config.CompoundCiopConfig, prNumber int, loggers Loggers, allowVolumes bool) []*prowconfig.Presubmit { rehearsals := []*prowconfig.Presubmit{} rehearsalsFiltered := filterJobs(toBeRehearsed, allowVolumes, loggers.Job) diff --git a/pkg/rehearse/jobs_test.go b/pkg/rehearse/jobs_test.go index 81671e46..d664abbb 100644 --- a/pkg/rehearse/jobs_test.go +++ b/pkg/rehearse/jobs_test.go @@ -89,12 +89,12 @@ func TestInlineCiopConfig(t *testing.T) { expectedEnv: []v1.EnvVar{{Name: "T", ValueFrom: makeCMReference("test-cm", "key")}}, }, { description: "CM reference to ci-operator-configs -> cm content inlined", - sourceEnv: []v1.EnvVar{{Name: "T", ValueFrom: makeCMReference(ciOperatorConfigsCMName, "filename")}}, + sourceEnv: []v1.EnvVar{{Name: "T", ValueFrom: makeCMReference(config.CiOperatorConfigsCMName, "filename")}}, configs: config.CompoundCiopConfig{"filename": testCiopConfig}, expectedEnv: []v1.EnvVar{{Name: "T", Value: string(testCiopCongigContent)}}, }, { description: "bad CM key is handled", - sourceEnv: []v1.EnvVar{{Name: "T", ValueFrom: makeCMReference(ciOperatorConfigsCMName, "filename")}}, + sourceEnv: []v1.EnvVar{{Name: "T", ValueFrom: makeCMReference(config.CiOperatorConfigsCMName, "filename")}}, configs: config.CompoundCiopConfig{}, expectedError: true, }, diff --git a/test/pj-rehearse-integration/expected_jobs.yaml b/test/pj-rehearse-integration/expected_jobs.yaml index 3f3ff5a6..f8019a05 100644 --- a/test/pj-rehearse-integration/expected_jobs.yaml +++ b/test/pj-rehearse-integration/expected_jobs.yaml @@ -1,3 +1,103 @@ +- apiVersion: prow.k8s.io/v1 + kind: ProwJob + metadata: + annotations: + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-ciop-cfg-change-images + creationTimestamp: null + labels: + ci.openshift.org/rehearse: "1234" + created-by-prow: "true" + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-ciop-cfg-change-images + prow.k8s.io/refs.org: openshift + prow.k8s.io/refs.pull: "1234" + prow.k8s.io/refs.repo: release + prow.k8s.io/type: presubmit + name: 9bdfbae2-405b-11e9-ac33-74d435fb2dc0 + namespace: test-namespace + spec: + agent: kubernetes + cluster: default + context: ci/rehearse/super/duper/ciop-cfg-change/images + decoration_config: + gcs_configuration: + bucket: origin-ci-test + default_org: openshift + default_repo: origin + path_strategy: single + gcs_credentials_secret: gce-sa-credentials-gcs-publisher + grace_period: 15000000000 + skip_cloning: true + timeout: 14400000000000 + utility_images: + clonerefs: gcr.io/k8s-prow/clonerefs:v20190129-0a3c54c + entrypoint: gcr.io/k8s-prow/entrypoint:v20190129-0a3c54c + initupload: gcr.io/k8s-prow/initupload:v20190129-0a3c54c + sidecar: gcr.io/k8s-prow/sidecar:v20190129-0a3c54c + job: rehearse-1234-pull-ci-super-duper-ciop-cfg-change-images + namespace: test-namespace + pod_spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --target=[images] + - --target=[release:latest] + - --git-ref=super/duper@ciop-cfg-change + command: + - ci-operator + env: + - name: CONFIG_SPEC + value: | + base_images: + base: + cluster: https://api.ci.openshift.org + name: origin-v4.0 + namespace: openshift + tag: base + build_root: + image_stream_tag: + cluster: https://api.ci.openshift.org + name: release + namespace: openshift + tag: golang-1.10 + canonical_go_repository: "" + images: + - from: base + to: test-image + - from: base + to: change-should-cause-rehearsal-of-all-jobs-that-use-this-cfg + resources: + '*': + limits: + cpu: 500Mi + requests: + cpu: 10Mi + tag_specification: + cluster: https://api.ci.openshift.org + name: origin-v4.0 + namespace: openshift + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + requests: + cpu: 10m + serviceAccountName: ci-operator + refs: + base_ref: master + base_sha: 328cef7c6235073b55754d503b98c9233eaa9955 + org: openshift + pulls: + - author: petr-muller + number: 1234 + sha: 2a4d89d759b611ad3f423378c7d78f3af15d78e2 + repo: release + report: true + rerun_command: /test pj-rehearse + type: presubmit + status: + startTime: "2019-03-06T22:03:01Z" + state: triggered - apiVersion: prow.k8s.io/v1 kind: ProwJob metadata: