Skip to content

Commit 62ec57c

Browse files
petr-mullerclaude
andcommitted
prowgen: use preset for registry pull credentials volume
Move the pull-secret volume and volumeMount from the hardcoded defaultPodSpec to a Prow preset (preset-ci-operator-image-pull). This is a proof of concept for using compositional Prow presets to deduplicate the ~28 lines of boilerplate volumes/mounts that are inlined into every one of the 126K+ generated Prowjob definitions. The preset is defined in openshift/release and matched via a new label added to all prowgen-generated jobs. The --image-import-pull-secret arg remains inline since presets cannot inject container args. Requires the corresponding preset definition in openshift/release: https://github.com/openshift/release/pull/XXXXX Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eefd6cf commit 62ec57c

137 files changed

Lines changed: 187 additions & 468 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/ci-operator-prowgen/testdata/zz_fixture_postsubmit_TestFromCIOperatorConfigToProwYaml_Custom_test_timeout.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ postsubmits:
2929
labels:
3030
ci-operator.openshift.io/is-promotion: "true"
3131
ci.openshift.io/generator: prowgen
32+
preset-ci-operator-image-pull: "true"
3233
max_concurrency: 1
3334
name: branch-ci-super-duper-branch-images
3435
spec:
@@ -55,9 +56,6 @@ postsubmits:
5556
- mountPath: /secrets/manifest-tool
5657
name: manifest-tool-local-pusher
5758
readOnly: true
58-
- mountPath: /etc/pull-secret
59-
name: pull-secret
60-
readOnly: true
6159
- mountPath: /etc/push-secret
6260
name: push-secret
6361
readOnly: true
@@ -69,9 +67,6 @@ postsubmits:
6967
- name: manifest-tool-local-pusher
7068
secret:
7169
secretName: manifest-tool-local-pusher
72-
- name: pull-secret
73-
secret:
74-
secretName: registry-pull-credentials
7570
- name: push-secret
7671
secret:
7772
secretName: registry-push-credentials-ci-central

cmd/ci-operator-prowgen/testdata/zz_fixture_postsubmit_TestFromCIOperatorConfigToProwYaml_Input_is_YAML_and_it_is_correctly_processed.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ postsubmits:
2929
labels:
3030
ci-operator.openshift.io/is-promotion: "true"
3131
ci.openshift.io/generator: prowgen
32+
preset-ci-operator-image-pull: "true"
3233
max_concurrency: 1
3334
name: branch-ci-super-duper-branch-images
3435
spec:
@@ -55,9 +56,6 @@ postsubmits:
5556
- mountPath: /secrets/manifest-tool
5657
name: manifest-tool-local-pusher
5758
readOnly: true
58-
- mountPath: /etc/pull-secret
59-
name: pull-secret
60-
readOnly: true
6159
- mountPath: /etc/push-secret
6260
name: push-secret
6361
readOnly: true
@@ -69,9 +67,6 @@ postsubmits:
6967
- name: manifest-tool-local-pusher
7068
secret:
7169
secretName: manifest-tool-local-pusher
72-
- name: pull-secret
73-
secret:
74-
secretName: registry-pull-credentials
7570
- name: push-secret
7671
secret:
7772
secretName: registry-push-credentials-ci-central

cmd/ci-operator-prowgen/testdata/zz_fixture_postsubmit_TestFromCIOperatorConfigToProwYaml_Using_a_variant_config__one_test_and_images__one_existing_job._Expect_one_presubmit__pre_post_submit_images_jobs._Existing_job_should_not_be_changed..yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ postsubmits:
3232
ci-operator.openshift.io/is-promotion: "true"
3333
ci-operator.openshift.io/variant: rhel
3434
ci.openshift.io/generator: prowgen
35+
preset-ci-operator-image-pull: "true"
3536
max_concurrency: 1
3637
name: branch-ci-super-duper-branch-rhel-images
3738
spec:
@@ -59,9 +60,6 @@ postsubmits:
5960
- mountPath: /secrets/manifest-tool
6061
name: manifest-tool-local-pusher
6162
readOnly: true
62-
- mountPath: /etc/pull-secret
63-
name: pull-secret
64-
readOnly: true
6563
- mountPath: /etc/push-secret
6664
name: push-secret
6765
readOnly: true
@@ -73,9 +71,6 @@ postsubmits:
7371
- name: manifest-tool-local-pusher
7472
secret:
7573
secretName: manifest-tool-local-pusher
76-
- name: pull-secret
77-
secret:
78-
secretName: registry-pull-credentials
7974
- name: push-secret
8075
secret:
8176
secretName: registry-push-credentials-ci-central

cmd/ci-operator-prowgen/testdata/zz_fixture_postsubmit_TestFromCIOperatorConfigToProwYaml_one_test_and_images__no_previous_jobs._Expect_test_presubmit__pre_post_submit_images_jobs.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ postsubmits:
1010
labels:
1111
ci-operator.openshift.io/is-promotion: "true"
1212
ci.openshift.io/generator: prowgen
13+
preset-ci-operator-image-pull: "true"
1314
max_concurrency: 1
1415
name: branch-ci-super-duper-branch-images
1516
spec:
@@ -36,9 +37,6 @@ postsubmits:
3637
- mountPath: /secrets/manifest-tool
3738
name: manifest-tool-local-pusher
3839
readOnly: true
39-
- mountPath: /etc/pull-secret
40-
name: pull-secret
41-
readOnly: true
4240
- mountPath: /etc/push-secret
4341
name: push-secret
4442
readOnly: true
@@ -50,9 +48,6 @@ postsubmits:
5048
- name: manifest-tool-local-pusher
5149
secret:
5250
secretName: manifest-tool-local-pusher
53-
- name: pull-secret
54-
secret:
55-
secretName: registry-pull-credentials
5651
- name: push-secret
5752
secret:
5853
secretName: registry-push-credentials-ci-central

cmd/ci-operator-prowgen/testdata/zz_fixture_presubmit_TestFromCIOperatorConfigToProwYaml_Custom_test_timeout.yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ presubmits:
1212
labels:
1313
ci.openshift.io/generator: prowgen
1414
pj-rehearse.openshift.io/can-be-rehearsed: "true"
15+
preset-ci-operator-image-pull: "true"
1516
name: pull-ci-super-duper-branch-images
1617
rerun_command: /test images
1718
spec:
@@ -36,9 +37,6 @@ presubmits:
3637
- mountPath: /secrets/manifest-tool
3738
name: manifest-tool-local-pusher
3839
readOnly: true
39-
- mountPath: /etc/pull-secret
40-
name: pull-secret
41-
readOnly: true
4240
- mountPath: /etc/report
4341
name: result-aggregator
4442
readOnly: true
@@ -47,9 +45,6 @@ presubmits:
4745
- name: manifest-tool-local-pusher
4846
secret:
4947
secretName: manifest-tool-local-pusher
50-
- name: pull-secret
51-
secret:
52-
secretName: registry-pull-credentials
5348
- name: result-aggregator
5449
secret:
5550
secretName: result-aggregator
@@ -67,6 +62,7 @@ presubmits:
6762
labels:
6863
ci.openshift.io/generator: prowgen
6964
pj-rehearse.openshift.io/can-be-rehearsed: "true"
65+
preset-ci-operator-image-pull: "true"
7066
name: pull-ci-super-duper-branch-unit
7167
rerun_command: /test unit
7268
spec:
@@ -91,9 +87,6 @@ presubmits:
9187
- mountPath: /secrets/manifest-tool
9288
name: manifest-tool-local-pusher
9389
readOnly: true
94-
- mountPath: /etc/pull-secret
95-
name: pull-secret
96-
readOnly: true
9790
- mountPath: /etc/report
9891
name: result-aggregator
9992
readOnly: true
@@ -102,9 +95,6 @@ presubmits:
10295
- name: manifest-tool-local-pusher
10396
secret:
10497
secretName: manifest-tool-local-pusher
105-
- name: pull-secret
106-
secret:
107-
secretName: registry-pull-credentials
10898
- name: result-aggregator
10999
secret:
110100
secretName: result-aggregator

cmd/ci-operator-prowgen/testdata/zz_fixture_presubmit_TestFromCIOperatorConfigToProwYaml_Input_is_YAML_and_it_is_correctly_processed.yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ presubmits:
1212
labels:
1313
ci.openshift.io/generator: prowgen
1414
pj-rehearse.openshift.io/can-be-rehearsed: "true"
15+
preset-ci-operator-image-pull: "true"
1516
name: pull-ci-super-duper-branch-images
1617
rerun_command: /test images
1718
spec:
@@ -36,9 +37,6 @@ presubmits:
3637
- mountPath: /secrets/manifest-tool
3738
name: manifest-tool-local-pusher
3839
readOnly: true
39-
- mountPath: /etc/pull-secret
40-
name: pull-secret
41-
readOnly: true
4240
- mountPath: /etc/report
4341
name: result-aggregator
4442
readOnly: true
@@ -47,9 +45,6 @@ presubmits:
4745
- name: manifest-tool-local-pusher
4846
secret:
4947
secretName: manifest-tool-local-pusher
50-
- name: pull-secret
51-
secret:
52-
secretName: registry-pull-credentials
5348
- name: result-aggregator
5449
secret:
5550
secretName: result-aggregator
@@ -66,6 +61,7 @@ presubmits:
6661
labels:
6762
ci.openshift.io/generator: prowgen
6863
pj-rehearse.openshift.io/can-be-rehearsed: "true"
64+
preset-ci-operator-image-pull: "true"
6965
name: pull-ci-super-duper-branch-unit
7066
rerun_command: /test unit
7167
spec:
@@ -90,9 +86,6 @@ presubmits:
9086
- mountPath: /secrets/manifest-tool
9187
name: manifest-tool-local-pusher
9288
readOnly: true
93-
- mountPath: /etc/pull-secret
94-
name: pull-secret
95-
readOnly: true
9689
- mountPath: /etc/report
9790
name: result-aggregator
9891
readOnly: true
@@ -101,9 +94,6 @@ presubmits:
10194
- name: manifest-tool-local-pusher
10295
secret:
10396
secretName: manifest-tool-local-pusher
104-
- name: pull-secret
105-
secret:
106-
secretName: registry-pull-credentials
10797
- name: result-aggregator
10898
secret:
10999
secretName: result-aggregator

cmd/ci-operator-prowgen/testdata/zz_fixture_presubmit_TestFromCIOperatorConfigToProwYaml_Using_a_variant_config__one_test_and_images__one_existing_job._Expect_one_presubmit__pre_post_submit_images_jobs._Existing_job_should_not_be_changed..yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ presubmits:
1313
ci-operator.openshift.io/variant: rhel
1414
ci.openshift.io/generator: prowgen
1515
pj-rehearse.openshift.io/can-be-rehearsed: "true"
16+
preset-ci-operator-image-pull: "true"
1617
name: pull-ci-super-duper-branch-rhel-images
1718
rerun_command: /test rhel-images
1819
spec:
@@ -38,9 +39,6 @@ presubmits:
3839
- mountPath: /secrets/manifest-tool
3940
name: manifest-tool-local-pusher
4041
readOnly: true
41-
- mountPath: /etc/pull-secret
42-
name: pull-secret
43-
readOnly: true
4442
- mountPath: /etc/report
4543
name: result-aggregator
4644
readOnly: true
@@ -49,9 +47,6 @@ presubmits:
4947
- name: manifest-tool-local-pusher
5048
secret:
5149
secretName: manifest-tool-local-pusher
52-
- name: pull-secret
53-
secret:
54-
secretName: registry-pull-credentials
5550
- name: result-aggregator
5651
secret:
5752
secretName: result-aggregator
@@ -69,6 +64,7 @@ presubmits:
6964
ci-operator.openshift.io/variant: rhel
7065
ci.openshift.io/generator: prowgen
7166
pj-rehearse.openshift.io/can-be-rehearsed: "true"
67+
preset-ci-operator-image-pull: "true"
7268
name: pull-ci-super-duper-branch-rhel-unit
7369
rerun_command: /test rhel-unit
7470
spec:
@@ -94,9 +90,6 @@ presubmits:
9490
- mountPath: /secrets/manifest-tool
9591
name: manifest-tool-local-pusher
9692
readOnly: true
97-
- mountPath: /etc/pull-secret
98-
name: pull-secret
99-
readOnly: true
10093
- mountPath: /etc/report
10194
name: result-aggregator
10295
readOnly: true
@@ -105,9 +98,6 @@ presubmits:
10598
- name: manifest-tool-local-pusher
10699
secret:
107100
secretName: manifest-tool-local-pusher
108-
- name: pull-secret
109-
secret:
110-
secretName: registry-pull-credentials
111101
- name: result-aggregator
112102
secret:
113103
secretName: result-aggregator

cmd/ci-operator-prowgen/testdata/zz_fixture_presubmit_TestFromCIOperatorConfigToProwYaml_one_test_and_images__no_previous_jobs._Expect_test_presubmit__pre_post_submit_images_jobs.yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ presubmits:
1212
labels:
1313
ci.openshift.io/generator: prowgen
1414
pj-rehearse.openshift.io/can-be-rehearsed: "true"
15+
preset-ci-operator-image-pull: "true"
1516
name: pull-ci-super-duper-branch-images
1617
rerun_command: /test images
1718
spec:
@@ -36,9 +37,6 @@ presubmits:
3637
- mountPath: /secrets/manifest-tool
3738
name: manifest-tool-local-pusher
3839
readOnly: true
39-
- mountPath: /etc/pull-secret
40-
name: pull-secret
41-
readOnly: true
4240
- mountPath: /etc/report
4341
name: result-aggregator
4442
readOnly: true
@@ -47,9 +45,6 @@ presubmits:
4745
- name: manifest-tool-local-pusher
4846
secret:
4947
secretName: manifest-tool-local-pusher
50-
- name: pull-secret
51-
secret:
52-
secretName: registry-pull-credentials
5348
- name: result-aggregator
5449
secret:
5550
secretName: result-aggregator
@@ -66,6 +61,7 @@ presubmits:
6661
labels:
6762
ci.openshift.io/generator: prowgen
6863
pj-rehearse.openshift.io/can-be-rehearsed: "true"
64+
preset-ci-operator-image-pull: "true"
6965
name: pull-ci-super-duper-branch-unit
7066
rerun_command: /test unit
7167
spec:
@@ -90,9 +86,6 @@ presubmits:
9086
- mountPath: /secrets/manifest-tool
9187
name: manifest-tool-local-pusher
9288
readOnly: true
93-
- mountPath: /etc/pull-secret
94-
name: pull-secret
95-
readOnly: true
9689
- mountPath: /etc/report
9790
name: result-aggregator
9891
readOnly: true
@@ -101,9 +94,6 @@ presubmits:
10194
- name: manifest-tool-local-pusher
10295
secret:
10396
secretName: manifest-tool-local-pusher
104-
- name: pull-secret
105-
secret:
106-
secretName: registry-pull-credentials
10797
- name: result-aggregator
10898
secret:
10999
secretName: result-aggregator

pkg/api/constant.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ const (
3737
NoBuildsLabel = "ci.openshift.io/no-builds"
3838
NoBuildsValue = "true"
3939

40+
// PresetImagePullLabel is the label that triggers the preset-ci-operator-image-pull
41+
// Prow preset, which provides the registry pull credentials volume and mount.
42+
PresetImagePullLabel = "preset-ci-operator-image-pull"
43+
4044
// HiveCluster is the cluster where Hive is deployed
4145
HiveCluster = ClusterHive
4246

pkg/prowgen/jobbase.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ func NewProwJobBaseBuilder(configSpec *cioperatorapi.ReleaseBuildConfiguration,
6161
PodSpec: podSpecGenerator,
6262
base: prowconfig.JobBase{
6363
Agent: string(prowv1.KubernetesAgent),
64-
Labels: map[string]string{},
64+
Labels: map[string]string{
65+
cioperatorapi.PresetImagePullLabel: "true",
66+
},
6567
UtilityConfig: prowconfig.UtilityConfig{
6668
Decorate: utilpointer.Bool(true),
6769
},

0 commit comments

Comments
 (0)