@@ -66,15 +66,19 @@ lock(resource: "build-node-image") {
66
66
def archinfo = arches.collectEntries{[it, [:]]}
67
67
def now = java.time.LocalDateTime.now()
68
68
def timestamp = now.format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMddHHmm"))
69
- def (container_registry_staging_repo, container_registry_repo, prod_tags) = pipeutils.get_ocp_node_registry_repo(pipecfg, params.RELEASE, timestamp)
70
- def container_registry_staging_manifest_tag = "${params.RELEASE}"
71
- def container_registry_staging_image_tag = "${params.RELEASE}"
72
- def container_registry_staging_manifest = "${container_registry_staging_repo}:${container_registry_staging_manifest_tag}"
69
+ def (registry_staging_repo, registry_staging_tags, registry_prod_repo, registry_prod_tags) = pipeutils.get_ocp_node_registry_repo(pipecfg, params.RELEASE, timestamp)
70
+
71
+ // `staging_tags` is a list to stay consistent with the `prod` objects,
72
+ // but we only need a single tag here since it's used solely for storing
73
+ // intermediary images before they are referenced in a multi-arch manifest.
74
+ def registry_staging_tag = registry_staging_tags[0]
73
75
74
76
// add any additional root CA cert before we do anything that fetches
75
77
pipeutils.addOptionalRootCA()
76
78
77
79
def yumrepos_file
80
+ def node_image_manifest_digest
81
+ def extensions_image_manifest_digest
78
82
stage('Init') {
79
83
shwrap("git clone ${stream_info.yumrepo.url} yumrepos")
80
84
for (repo in stream_info.yumrepo.files) {
@@ -85,18 +89,15 @@ lock(resource: "build-node-image") {
85
89
archiveArtifacts 'all.repo'
86
90
}
87
91
88
- if (params.PIPECFG_HOTFIX_REPO || params.PIPECFG_HOTFIX_REF) {
89
- container_registry_staging_image_tag += "-hotfix-${pipecfg.hotfix.name}"
90
- }
91
92
stage('Build Node Image') {
92
93
withCredentials([file(credentialsId: 'oscontainer-push-registry-secret', variable: 'REGISTRY_AUTH_FILE')]) {
93
94
def build_from = params.FROM ?: stream_info.from
94
- pipeutils.build_and_push_image(arches: arches,
95
+ node_image_manifest_digest = pipeutils.build_and_push_image(arches: arches,
95
96
src_commit: commit,
96
97
src_url: src_config_url,
97
- staging_repository: container_registry_staging_repo ,
98
- image_tag_staging: container_registry_staging_image_tag ,
99
- manifest_tag_staging: container_registry_staging_manifest_tag ,
98
+ staging_repository: registry_staging_repo ,
99
+ image_tag_staging: registry_staging_tag ,
100
+ manifest_tag_staging: "${registry_staging_tag}" ,
100
101
secret: "id=yumrepos,src=${yumrepos_file}", // notsecret (for secret scanners)
101
102
from: build_from,
102
103
extra_build_args: ["--security-opt label=disable", "--mount-host-ca-certs", "--force"])
@@ -105,13 +106,13 @@ lock(resource: "build-node-image") {
105
106
stage('Build Extensions Image') {
106
107
withCredentials([file(credentialsId: 'oscontainer-push-registry-secret', variable: 'REGISTRY_AUTH_FILE')]) {
107
108
// Use the node image as from
108
- def build_from = container_registry_staging_manifest
109
- pipeutils.build_and_push_image(arches: arches,
109
+ def build_from = "${registry_staging_repo}@${node_image_manifest_digest}"
110
+ extensions_image_manifest_digest = pipeutils.build_and_push_image(arches: arches,
110
111
src_commit: commit,
111
112
src_url: src_config_url,
112
- staging_repository: container_registry_staging_repo ,
113
- image_tag_staging: "${container_registry_staging_image_tag }-extensions",
114
- manifest_tag_staging: "${container_registry_staging_manifest_tag }-extensions",
113
+ staging_repository: registry_staging_repo ,
114
+ image_tag_staging: "${registry_staging_tag }-extensions",
115
+ manifest_tag_staging: "${registry_staging_tag }-extensions",
115
116
secret: "id=yumrepos,src=${yumrepos_file}", // notsecret (for secret scanners)
116
117
from: build_from,
117
118
extra_build_args: ["--security-opt label=disable", "--mount-host-ca-certs",
@@ -123,16 +124,17 @@ lock(resource: "build-node-image") {
123
124
// copy the extensions first as the node image existing is a signal
124
125
// that it's ready for release. So we want all the expected artifacts
125
126
// to be available when the ART tooling kicks in.
126
- for ( tag in prod_tags ) {
127
- pipeutils.copy_image("${container_registry_staging_manifest}-extensions",
128
- "${container_registry_repo}:${tag}-extensions")
129
- }
130
127
131
128
// Skopeo does not support pushing multiple tags at the same time
132
129
// So we just recopy the same image multiple times.
133
130
// https://github.com/containers/skopeo/issues/513
134
- for (tag in prod_tags) {
135
- pipeutils.copy_image(container_registry_staging_manifest, "${container_registry_repo}:${tag}")
131
+ for (tag in registry_prod_tags) {
132
+ pipeutils.copy_image("${registry_staging_repo}@${extensions_image_manifest_digest}",
133
+ "${registry_prod_repo}:${tag}-extensions")
134
+ }
135
+ for (tag in registry_prod_tags) {
136
+ pipeutils.copy_image("${registry_staging_repo}@${node_image_manifest_digest}",
137
+ "${registry_prod_repo}:${tag}")
136
138
}
137
139
}
138
140
}
0 commit comments