From 9bb8823ce0137f5ad777ce0ccd94e7c9e402a077 Mon Sep 17 00:00:00 2001 From: Nikolaos Moraitis Date: Thu, 28 Mar 2019 16:33:56 +0100 Subject: [PATCH 1/2] on a template change, rehearse all cluster types. --- cmd/pj-rehearse/main.go | 11 ++-- pkg/rehearse/jobs.go | 102 +++++++++++++++++++++++++++++++------- pkg/rehearse/jobs_test.go | 54 ++++++++++---------- 3 files changed, 120 insertions(+), 47 deletions(-) diff --git a/cmd/pj-rehearse/main.go b/cmd/pj-rehearse/main.go index 86fa0b15..9ee2f4c2 100644 --- a/cmd/pj-rehearse/main.go +++ b/cmd/pj-rehearse/main.go @@ -253,9 +253,14 @@ func rehearseMain() int { metrics.RecordChangedPresubmits(toRehearse) metrics.RecordOpportunity(toRehearse, "direct-change") - presubmitsWitchChangedCiopConfigs := diffs.GetPresubmitsForCiopConfigs(prConfig.Prow, changedCiopConfigs, logger, affectedJobs) - metrics.RecordOpportunity(presubmitsWitchChangedCiopConfigs, "ci-operator-config-change") - toRehearse.AddAll(presubmitsWitchChangedCiopConfigs) + presubmitsWithChangedCiopConfigs := diffs.GetPresubmitsForCiopConfigs(prConfig.Prow, changedCiopConfigs, logger, affectedJobs) + metrics.RecordOpportunity(presubmitsWithChangedCiopConfigs, "ci-operator-config-change") + toRehearse.AddAll(presubmitsWithChangedCiopConfigs) + + presubmitsWithChangedTemplates := rehearse.AddRandomJobsForChangedTemplates(changedTemplates, prConfig.Prow.JobConfig.Presubmits, loggers, prNumber) + metrics.RecordOpportunity(presubmitsWithChangedTemplates, "templates-change") + toRehearse.AddAll(presubmitsWithChangedTemplates) + toRehearseClusterProfiles := diffs.GetPresubmitsForClusterProfiles(prConfig.Prow, changedClusterProfiles, logger) metrics.RecordOpportunity(toRehearseClusterProfiles, "cluster-profile-change") toRehearse.AddAll(toRehearseClusterProfiles) diff --git a/pkg/rehearse/jobs.go b/pkg/rehearse/jobs.go index 9c615cbb..5849630d 100644 --- a/pkg/rehearse/jobs.go +++ b/pkg/rehearse/jobs.go @@ -38,6 +38,8 @@ const ( logRehearsalJob = "rehearsal-job" logCiopConfigFile = "ciop-config-file" logCiopConfigRepo = "ciop-config-repo" + + clusterTypeEnvName = "CLUSTER_TYPE" ) // Loggers holds the two loggers that will be used for normal and debug logging respectively. @@ -203,17 +205,14 @@ func ConfigureRehearsalJobs(toBeRehearsed config.Presubmits, ciopConfigs config. continue } - exists, index, templateKey := hasChangedTemplateVolume(rehearsal.Spec.Containers[0].VolumeMounts, rehearsal.Spec.Volumes, templates) - if exists { - if templateData, err := config.GetTemplateData(templates[templateKey]); err != nil { - jobLogger.WithError(err).WithField("template-name", templates[templateKey].Name).Warn("couldn't get template's data. Job won't be rehearsed") + if allowVolumes { + if err := replaceCMTemplateName(rehearsal.Spec.Containers[0].VolumeMounts, rehearsal.Spec.Volumes, templates); err != nil { + jobLogger.WithError(err).Warn("Failed to replace the configmap name to the temporary one") continue - } else { - templateName := config.GetTemplateName(templateKey) - rehearsal.Spec.Volumes[index].VolumeSource.ConfigMap.Name = config.GetTempCMName(templateName, templateKey, templateData) } + + replaceClusterProfiles(rehearsal.Spec.Volumes, profiles, loggers.Debug.WithField("name", job.Name)) } - replaceClusterProfiles(rehearsal.Spec.Volumes, profiles, loggers.Debug.WithField("name", job.Name)) jobLogger.WithField(logRehearsalJob, rehearsal.Name).Info("Created a rehearsal job to be submitted") rehearsals = append(rehearsals, rehearsal) @@ -223,24 +222,93 @@ func ConfigureRehearsalJobs(toBeRehearsed config.Presubmits, ciopConfigs config. return rehearsals } -func hasChangedTemplateVolume(volumeMounts []v1.VolumeMount, volumes []v1.Volume, templates config.CiTemplates) (bool, int, string) { - var templateKey string - var volumeName string +// AddRandomJobsForChangedTemplates finds jobs from the PR config that are using a specific template with a specific cluster type. +// The job selection is done by iterating in an unspecified order, which avoids picking the same job +// So if a template will be changed, find the jobs that are using a template in combination with the `aws`,`openstack`,`gcs` and `libvirt` cluster types. +func AddRandomJobsForChangedTemplates(templates config.CiTemplates, prConfigPresubmits map[string][]prowconfig.Presubmit, loggers Loggers, prNumber int) config.Presubmits { + rehearsals := make(config.Presubmits) + + for templateFile := range templates { + for _, clusterType := range []string{"aws", "gcs", "openstack", "libvirt"} { + if repo, job := pickTemplateJob(prConfigPresubmits, templateFile, clusterType); job != nil { + jobLogger := loggers.Job.WithFields(logrus.Fields{"target-repo": repo, "target-job": job.Name}) + jobLogger.Info("Picking job to rehearse the template changes") + rehearsals[repo] = append(rehearsals[repo], *job) + } + } + } + return rehearsals +} + +func replaceCMTemplateName(volumeMounts []v1.VolumeMount, volumes []v1.Volume, templates config.CiTemplates) error { + replace := func(v *v1.Volume) error { + volumeName, templateKey := hasChangedTemplateVolume(volumeMounts, *v, templates) + if len(volumeName) == 0 || len(templateKey) == 0 || volumeName != v.Name { + return nil + } + + templateData, err := config.GetTemplateData(templates[templateKey]) + if err != nil { + return fmt.Errorf("couldn't get template's data: %s: %v", templates[templateKey], err) + } + + name := config.GetTempCMName(config.GetTemplateName(templateKey), templateKey, templateData) + v.VolumeSource.ConfigMap.Name = name + + return nil + } + + for _, volume := range volumes { + if err := replace(&volume); err != nil { + return err + } + } + return nil +} + +func hasChangedTemplateVolume(volumeMounts []v1.VolumeMount, volume v1.Volume, templates config.CiTemplates) (string, string) { for _, volumeMount := range volumeMounts { if _, ok := templates[volumeMount.SubPath]; ok { - templateKey = volumeMount.SubPath - volumeName = volumeMount.Name + return volumeMount.Name, volumeMount.SubPath } } + return "", "" +} - for index, volume := range volumes { - if volume.Name == volumeName { - return true, index, templateKey +func pickTemplateJob(presubmits map[string][]prowconfig.Presubmit, templateFile, clusterType string) (string, *prowconfig.Presubmit) { + for repo, jobs := range presubmits { + for _, job := range jobs { + if job.Agent != string(pjapi.KubernetesAgent) { + continue + } + + if hasClusterType(job, clusterType) && hasTemplateFile(job, templateFile) { + return repo, &job + } } } + return "", nil +} + +func hasClusterType(job prowconfig.Presubmit, clusterType string) bool { + for _, env := range job.Spec.Containers[0].Env { + if env.Name == clusterTypeEnvName && env.Value == clusterType { + return true + } + } + return false +} - return false, 0, "" +func hasTemplateFile(job prowconfig.Presubmit, templateFile string) bool { + if job.Spec.Containers[0].VolumeMounts != nil { + for _, volumeMount := range job.Spec.Containers[0].VolumeMounts { + if volumeMount.SubPath == templateFile { + return true + } + } + } + return false } func replaceClusterProfiles(volumes []v1.Volume, profiles []config.ClusterProfile, logger *logrus.Entry) { diff --git a/pkg/rehearse/jobs_test.go b/pkg/rehearse/jobs_test.go index ff1b5955..bd5ae7e8 100644 --- a/pkg/rehearse/jobs_test.go +++ b/pkg/rehearse/jobs_test.go @@ -827,7 +827,9 @@ func makeBasePresubmit() *prowconfig.Presubmit { } } -func TestHasChangedTemplateVolume(t *testing.T) { +func TestReplaceCMTemplateName(t *testing.T) { + const tempCMName = "rehearse-pv8j80dg-test-template" + templates := config.CiTemplates{ "test-template.yaml": &templateapi.Template{ ObjectMeta: metav1.ObjectMeta{ @@ -846,23 +848,17 @@ func TestHasChangedTemplateVolume(t *testing.T) { }, } - type expectedToFind struct { - exists bool - index int - templateKey string - } - testCases := []struct { description string jobVolumeMounts []v1.VolumeMount jobVolumes []v1.Volume - expectedToFind expectedToFind + expectedToFind func() []v1.Volume }{ { description: "no volumes", jobVolumeMounts: []v1.VolumeMount{}, jobVolumes: []v1.Volume{}, - expectedToFind: expectedToFind{}, + expectedToFind: func() []v1.Volume { return []v1.Volume{} }, }, { description: "find one in multiple volumes", @@ -878,10 +874,14 @@ func TestHasChangedTemplateVolume(t *testing.T) { }, }, jobVolumes: createVolumesHelper("job-definition", "test-template.yaml"), - expectedToFind: expectedToFind{ - exists: true, - index: 2, - templateKey: "test-template.yaml", + expectedToFind: func() []v1.Volume { + volumes := createVolumesHelper("job-definition", "test-template.yaml") + for _, volume := range volumes { + if volume.Name == "job-definition" { + volume.VolumeSource.ConfigMap.Name = tempCMName + } + } + return volumes }, }, { @@ -898,10 +898,10 @@ func TestHasChangedTemplateVolume(t *testing.T) { }, }, jobVolumes: append(createVolumesHelper("job-definition", "test-template.yaml"), createVolumesHelper("job-definition2", "test-template2.yaml")...), - expectedToFind: expectedToFind{ - exists: true, - index: 2, - templateKey: "test-template.yaml", + expectedToFind: func() []v1.Volume { + volumes := append(createVolumesHelper("job-definition", "test-template.yaml"), createVolumesHelper("job-definition2", "test-template2.yaml")...) + volumes[2].VolumeSource.ConfigMap.Name = tempCMName + return volumes }, }, { @@ -917,21 +917,22 @@ func TestHasChangedTemplateVolume(t *testing.T) { SubPath: "test-template5.yaml", }, }, - jobVolumes: createVolumesHelper("job-definition", "test-template5.yaml"), - expectedToFind: expectedToFind{}, + jobVolumes: createVolumesHelper("job-definition", "test-template5.yaml"), + expectedToFind: func() []v1.Volume { + return createVolumesHelper("job-definition", "test-template5.yaml") + }, }, } for _, testCase := range testCases { t.Run(testCase.description, func(t *testing.T) { - exists, index, templateKey := hasChangedTemplateVolume(testCase.jobVolumeMounts, testCase.jobVolumes, templates) - found := expectedToFind{ - exists: exists, - index: index, - templateKey: templateKey, + if err := replaceCMTemplateName(testCase.jobVolumeMounts, testCase.jobVolumes, templates); err != nil { + t.Fatal() } - if !reflect.DeepEqual(testCase.expectedToFind, found) { - t.Fatalf("Expected:%v\nFound:%v", testCase.expectedToFind, found) + + expected := testCase.expectedToFind() + if !reflect.DeepEqual(expected, testCase.jobVolumes) { + t.Fatalf("Diff found %v", diff.ObjectReflectDiff(expected, testCase.jobVolumes)) } }) } @@ -960,7 +961,6 @@ func createVolumesHelper(name, key string) []v1.Volume { }, }, } - volumes = append(volumes, v1.Volume{ Name: name, VolumeSource: v1.VolumeSource{ From 84964914fcc56a73628c4f50e32be1720e68b50a Mon Sep 17 00:00:00 2001 From: Nikolaos Moraitis Date: Thu, 28 Mar 2019 16:34:30 +0100 Subject: [PATCH 2/2] include templates in integration tests --- .../duper/super-duper-master-presubmits.yaml | 114 ++++ .../ci-operator/templates/test-template.yaml | 1 + .../expected_jobs.yaml | 493 +++++++++++++++++- .../duper/super-duper-master-presubmits.yaml | 114 ++++ test/pj-rehearse-integration/run.sh | 2 +- 5 files changed, 721 insertions(+), 3 deletions(-) diff --git a/test/pj-rehearse-integration/candidate/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml b/test/pj-rehearse-integration/candidate/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml index 7cc6dab8..a09f9b50 100644 --- a/test/pj-rehearse-integration/candidate/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml +++ b/test/pj-rehearse-integration/candidate/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml @@ -201,3 +201,117 @@ presubmits: name: test_pull_request_origin_extended_gssapi rerun_command: /test extended_gssapi trigger: ((?m)^/test extended_gssapi,?(\s+|$)) + - agent: kubernetes + always_run: true + branches: + - master + context: ci/prow/test-template-e2e-aws + decorate: true + decoration_config: + skip_cloning: true + name: pull-ci-super-duper-master-test-template-e2e-aws + rerun_command: /test test-template-e2e-aws + spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: aws + - name: CONFIG_SPEC + valueFrom: + configMapKeyRef: + key: super-duper-master.yaml + name: ci-operator-master-configs + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: TEST_SUITE=openshift/conformance/parallel run-tests + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-aws-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-aws + name: job-definition + subPath: test-template.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-aws + - configMap: + name: prow-job-cluster-launch-installer-e2e + name: job-definition + trigger: ((?m)^/test( all| test-template-e2e-aws),?(\s+|$)) + - agent: kubernetes + always_run: true + branches: + - master + context: ci/prow/test-template-e2e-openstack + decorate: true + decoration_config: + skip_cloning: true + name: pull-ci-super-duper-master-test-template-e2e-openstack + rerun_command: /test test-template-e2e-openstack + spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws-openstack + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: openstack + - name: CONFIG_SPEC + valueFrom: + configMapKeyRef: + key: super-duper-master.yaml + name: ci-operator-master-configs + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: TEST_SUITE=openshift/conformance/parallel run-tests + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-openstack-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-openstack + name: job-definition + subPath: test-template.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-openstack + - configMap: + name: prow-job-cluster-launch-installer-e2e + name: job-definition + trigger: ((?m)^/test( all| test-template-e2e-openstack),?(\s+|$)) \ No newline at end of file diff --git a/test/pj-rehearse-integration/candidate/ci-operator/templates/test-template.yaml b/test/pj-rehearse-integration/candidate/ci-operator/templates/test-template.yaml index e93c6072..4b355dc3 100644 --- a/test/pj-rehearse-integration/candidate/ci-operator/templates/test-template.yaml +++ b/test/pj-rehearse-integration/candidate/ci-operator/templates/test-template.yaml @@ -83,6 +83,7 @@ objects: command: - echo - test + - CHANGED # Runs an install - name: setup diff --git a/test/pj-rehearse-integration/expected_jobs.yaml b/test/pj-rehearse-integration/expected_jobs.yaml index 85981816..4085c669 100644 --- a/test/pj-rehearse-integration/expected_jobs.yaml +++ b/test/pj-rehearse-integration/expected_jobs.yaml @@ -192,7 +192,128 @@ rerun_command: /test pj-rehearse type: presubmit status: - startTime: "2019-02-11T17:02:53Z" + startTime: "2019-03-06T22:03:01Z" + state: triggered +- apiVersion: prow.k8s.io/v1 + kind: ProwJob + metadata: + annotations: + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-master-e2e-aws + creationTimestamp: null + labels: + ci.openshift.org/rehearse: "1234" + created-by-prow: "true" + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-master-e2e-aws + prow.k8s.io/refs.org: openshift + prow.k8s.io/refs.pull: "1234" + prow.k8s.io/refs.repo: release + prow.k8s.io/type: presubmit + name: 44acebef-4fc4-11e9-b82b-54e1ad07d68a + namespace: test-namespace + spec: + agent: kubernetes + cluster: default + context: ci/rehearse/super/duper/master/e2e-aws + 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-master-e2e-aws + namespace: test-namespace + pod_spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws + - --git-ref=super/duper@master + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: aws + - 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 + images: + - from: base + to: test-image + resources: + '*': + limits: + cpu: 500Mi + requests: + cpu: 10Mi + tag_specification: + cluster: https://api.ci.openshift.org + name: origin-v4.0 + namespace: openshift + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: changed command + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-aws-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-aws + name: job-definition + subPath: cluster-launch-installer-e2e.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-aws + - configMap: + name: prow-job-cluster-launch-installer-e2e + name: job-definition + refs: + base_ref: master + base_sha: 7effc9d6d41c9038e853dc54814eaace10f0bbfa + org: openshift + pulls: + - author: petr-muller + number: 1234 + sha: bb928f30f5790ce48231cb1b2601a135869da8cc + 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 @@ -292,6 +413,248 @@ status: startTime: "2019-02-11T17:02:53Z" state: triggered +- apiVersion: prow.k8s.io/v1 + kind: ProwJob + metadata: + annotations: + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-master-test-template-e2e-aws + creationTimestamp: null + labels: + ci.openshift.org/rehearse: "1234" + created-by-prow: "true" + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-master-test-template-e2e-aws + prow.k8s.io/refs.org: openshift + prow.k8s.io/refs.pull: "1234" + prow.k8s.io/refs.repo: release + prow.k8s.io/type: presubmit + name: ab89c04c-4fc2-11e9-96b2-54e1ad07d68a + namespace: test-namespace + spec: + agent: kubernetes + cluster: default + context: ci/rehearse/super/duper/master/test-template-e2e-aws + 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-master-test-template-e2e-aws + namespace: test-namespace + pod_spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws + - --git-ref=super/duper@master + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: aws + - 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 + images: + - from: base + to: test-image + resources: + '*': + limits: + cpu: 500Mi + requests: + cpu: 10Mi + tag_specification: + cluster: https://api.ci.openshift.org + name: origin-v4.0 + namespace: openshift + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: TEST_SUITE=openshift/conformance/parallel run-tests + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-aws-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-aws + name: job-definition + subPath: test-template.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-aws + - configMap: + name: rehearse-bv4qjcyg-test-template + name: job-definition + refs: + base_ref: master + base_sha: bfd4c4d0fe97177b4278dfef1691c7ef8dca1af0 + org: openshift + pulls: + - author: petr-muller + number: 1234 + sha: 4fe34c7d9b223067e30397a98a64bc0915d602e2 + repo: release + report: true + rerun_command: /test pj-rehearse + type: presubmit + status: + startTime: "2019-03-26T12:28:33Z" + state: triggered +- apiVersion: prow.k8s.io/v1 + kind: ProwJob + metadata: + annotations: + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-master-test-template-e2e-openstack + creationTimestamp: null + labels: + ci.openshift.org/rehearse: "1234" + created-by-prow: "true" + prow.k8s.io/job: rehearse-1234-pull-ci-super-duper-master-test-template-e2e-open + prow.k8s.io/refs.org: openshift + prow.k8s.io/refs.pull: "1234" + prow.k8s.io/refs.repo: release + prow.k8s.io/type: presubmit + name: ab89c26f-4fc2-11e9-96b2-54e1ad07d68a + namespace: test-namespace + spec: + agent: kubernetes + cluster: default + context: ci/rehearse/super/duper/master/test-template-e2e-openstack + 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-master-test-template-e2e-openstack + namespace: test-namespace + pod_spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws-openstack + - --git-ref=super/duper@master + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: openstack + - 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 + images: + - from: base + to: test-image + resources: + '*': + limits: + cpu: 500Mi + requests: + cpu: 10Mi + tag_specification: + cluster: https://api.ci.openshift.org + name: origin-v4.0 + namespace: openshift + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: TEST_SUITE=openshift/conformance/parallel run-tests + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-openstack-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-openstack + name: job-definition + subPath: test-template.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-openstack + - configMap: + name: rehearse-bv4qjcyg-test-template + name: job-definition + refs: + base_ref: master + base_sha: bfd4c4d0fe97177b4278dfef1691c7ef8dca1af0 + org: openshift + pulls: + - author: petr-muller + number: 1234 + sha: 4fe34c7d9b223067e30397a98a64bc0915d602e2 + repo: release + report: true + rerun_command: /test pj-rehearse + type: presubmit + status: + startTime: "2019-03-26T12:28:33Z" + state: triggered - apiVersion: prow.k8s.io/v1 kind: ProwJob metadata: @@ -387,7 +750,133 @@ pulls: - author: petr-muller number: 1234 - sha: 7c0b9788f819121ac637fa3f8a319d0bc2cda73e + sha: bb928f30f5790ce48231cb1b2601a135869da8cc + 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: + annotations: + prow.k8s.io/job: rehearse-1234-pull-ci-super-trooper-master-e2e-aws + creationTimestamp: null + labels: + ci.openshift.org/rehearse: "1234" + created-by-prow: "true" + prow.k8s.io/job: rehearse-1234-pull-ci-super-trooper-master-e2e-aws + prow.k8s.io/refs.org: openshift + prow.k8s.io/refs.pull: "1234" + prow.k8s.io/refs.repo: release + prow.k8s.io/type: presubmit + name: 44acf399-4fc4-11e9-b82b-54e1ad07d68a + namespace: test-namespace + spec: + agent: kubernetes + cluster: default + context: ci/rehearse/super/trooper/master/e2e-aws + 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-trooper-master-e2e-aws + namespace: test-namespace + pod_spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws + - --git-ref=super/trooper@master + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: aws + - 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 + images: + - from: base + to: test-image + resources: + '*': + limits: + cpu: 500Mi + requests: + cpu: 10Mi + tag_specification: + cluster: https://api.ci.openshift.org + name: origin-v4.0 + namespace: openshift + tests: + - as: unit + commands: make unit CHANGED + container: + from: src + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: changed command + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-aws-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-aws + name: job-definition + subPath: cluster-launch-installer-e2e.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-aws + - configMap: + name: prow-job-cluster-launch-installer-e2e + name: job-definition + refs: + base_ref: master + base_sha: 7effc9d6d41c9038e853dc54814eaace10f0bbfa + org: openshift + pulls: + - author: petr-muller + number: 1234 + sha: bb928f30f5790ce48231cb1b2601a135869da8cc repo: release report: true rerun_command: /test pj-rehearse diff --git a/test/pj-rehearse-integration/master/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml b/test/pj-rehearse-integration/master/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml index a0835d8d..b6fe9b88 100644 --- a/test/pj-rehearse-integration/master/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml +++ b/test/pj-rehearse-integration/master/ci-operator/jobs/super/duper/super-duper-master-presubmits.yaml @@ -201,3 +201,117 @@ presubmits: name: test_pull_request_origin_extended_gssapi rerun_command: /test extended_gssapi trigger: ((?m)^/test extended_gssapi,?(\s+|$)) + - agent: kubernetes + always_run: true + branches: + - master + context: ci/prow/test-template-e2e-aws + decorate: true + decoration_config: + skip_cloning: true + name: pull-ci-super-duper-master-test-template-e2e-aws + rerun_command: /test test-template-e2e-aws + spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: aws + - name: CONFIG_SPEC + valueFrom: + configMapKeyRef: + key: super-duper-master.yaml + name: ci-operator-master-configs + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: TEST_SUITE=openshift/conformance/parallel run-tests + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-aws-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-aws + name: job-definition + subPath: test-template.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-aws + - configMap: + name: prow-job-cluster-launch-installer-e2e + name: job-definition + trigger: ((?m)^/test( all| test-template-e2e-aws),?(\s+|$)) + - agent: kubernetes + always_run: true + branches: + - master + context: ci/prow/test-template-e2e-openstack + decorate: true + decoration_config: + skip_cloning: true + name: pull-ci-super-duper-master-test-template-e2e-openstack + rerun_command: /test test-template-e2e-openstack + spec: + containers: + - args: + - --artifact-dir=$(ARTIFACTS) + - --give-pr-author-access-to-namespace=true + - --secret-dir=/usr/local/e2e-aws-cluster-profile + - --target=e2e-aws + - --template=/usr/local/e2e-aws-openstack + command: + - ci-operator + env: + - name: CLUSTER_TYPE + value: openstack + - name: CONFIG_SPEC + valueFrom: + configMapKeyRef: + key: super-duper-master.yaml + name: ci-operator-master-configs + - name: JOB_NAME_SAFE + value: e2e-aws + - name: TEST_COMMAND + value: TEST_SUITE=openshift/conformance/parallel run-tests + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + limits: + cpu: 500m + requests: + cpu: 10m + volumeMounts: + - mountPath: /usr/local/e2e-openstack-cluster-profile + name: cluster-profile + - mountPath: /usr/local/e2e-openstack + name: job-definition + subPath: test-template.yaml + serviceAccountName: ci-operator + volumes: + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-openstack + - configMap: + name: prow-job-cluster-launch-installer-e2e + name: job-definition + trigger: ((?m)^/test( all| test-template-e2e-openstack),?(\s+|$)) \ No newline at end of file diff --git a/test/pj-rehearse-integration/run.sh b/test/pj-rehearse-integration/run.sh index d67cd4c5..7d110eec 100755 --- a/test/pj-rehearse-integration/run.sh +++ b/test/pj-rehearse-integration/run.sh @@ -52,7 +52,7 @@ make_testing_repository readonly REHEARSED_JOBS="${WORKDIR}/rehearsals.yaml" echo "[INFO] Running pj-rehearse in dry-mode..." -if ! pj-rehearse --dry-run=true --no-fail=false --candidate-path "${FAKE_OPENSHIFT_RELEASE}" > "${REHEARSED_JOBS}" 2> "${WORKDIR}/pj-rehearse-stderr.log"; then +if ! pj-rehearse --dry-run=true --no-fail=false --allow-volumes=true --candidate-path "${FAKE_OPENSHIFT_RELEASE}" > "${REHEARSED_JOBS}" 2> "${WORKDIR}/pj-rehearse-stderr.log"; then echo "[ERROR] pj-rehearse failed:" cat "${WORKDIR}/pj-rehearse-stderr.log" exit 1