Skip to content

Commit 9db798a

Browse files
committed
jobs/release: use cosa-copy-container when pushing to multiple repos
cosa push-container-manifest does not work if the remote registry does not support multi-arch manifests. cosa copy-container does but does not support copying from local manifests or `oci-archive` so we push the manifests to the first repo in the list then copy from there.
1 parent 2035d97 commit 9db798a

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

Diff for: jobs/release.Jenkinsfile

+29-7
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,39 @@ lock(resource: "release-${params.STREAM}", extra: locks) {
267267
credentialsId: 'oscontainer-push-registry-secret')]) {
268268
def repos = registry_repos[configname]
269269
def (artifact, metajsonname) = val
270+
// XXX: remove this workaround when registy.ci.org supports multi-arch manifests
271+
// push the manifest to the first repo in the list
272+
def tag_args = repos[0].tags.collect{"--tag=$it"}
273+
def v2s2_arg = repos[0].v2s2 ? "--v2s2" : ""
274+
shwrap("""
275+
export COSA_SUPERMIN_MEMORY=1024 # this really shouldn't require much RAM
276+
cp \${REGISTRY_SECRET} tmp/push-secret-${metajsonname}
277+
cosa supermin-run /usr/lib/coreos-assembler/cmd-push-container-manifest \
278+
--auth=tmp/push-secret-${metajsonname} \
279+
--repo=${repos[0].repo} ${tag_args.join(' ')} \
280+
--artifact=${artifact} --metajsonname=${metajsonname} \
281+
--build=${params.VERSION} ${v2s2_arg}
282+
rm tmp/push-secret-${metajsonname}
283+
""")
284+
285+
// for subsequent repos we use copy-container to copy the image
286+
// from that first repo to the others because some registries (registry.ci.openshift.org)
287+
// do not support multi-arch manifests.
288+
// cosa copy-container have the magic to know this and push separate images
289+
// with the arch as a tag suffix instead of a manifest.
290+
def src_repo = repos[0].repo
291+
def src_tag = repos[0].tags[0]
292+
repos.remove(0)
270293
for (repo in repos) {
271-
def tag_args = repo.tags.collect{"--tag=$it"}
272-
def v2s2_arg = repo.v2s2 ? "--v2s2" : ""
294+
tag_args = repo.tags.collect{"--tag=$it"}
295+
v2s2_arg = repo.v2s2 ? "--v2s2" : ""
273296
shwrap("""
274297
export COSA_SUPERMIN_MEMORY=1024 # this really shouldn't require much RAM
275298
cp \${REGISTRY_SECRET} tmp/push-secret-${metajsonname}
276-
cosa supermin-run /usr/lib/coreos-assembler/cmd-push-container-manifest \
277-
--auth=tmp/push-secret-${metajsonname} \
278-
--repo=${repo.repo} ${tag_args.join(' ')} \
279-
--artifact=${artifact} --metajsonname=${metajsonname} \
280-
--build=${params.VERSION} ${v2s2_arg}
299+
cosa supermin-run /usr/lib/coreos-assembler/cmd-copy-container \
300+
--authfile=tmp/push-secret-${metajsonname} \
301+
--tag ${src_tag} ${tag_args.join(' ')} ${v2s2_arg} \
302+
${src_repo} ${repo.repo}
281303
rm tmp/push-secret-${metajsonname}
282304
""")
283305
}

0 commit comments

Comments
 (0)