Skip to content

Commit e69247e

Browse files
jbtrystramjlebon
authored andcommitted
jobs:build-node-image: support publishing v2s2 manifests
Some ART tooling does not support OCI manifests yet, so allow creating the manifests in v2s2 support. This is already supported by COSA so it's just passing the correct flag and tie it to a knob. Defaults to false.
1 parent 31176fb commit e69247e

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

docs/config.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,18 @@ ocp_node_builds:
316316
# REQUIRED: knobs related to the source config
317317
registries:
318318
# REQUIRED: staging repo to push the final image built
319-
staging: registry.ci.openshift.org/coreos/node-staginear
319+
staging:
320+
image: registry.ci.openshift.org/coreos/node-staging
321+
# REQUIRED: one or more tags to attach to the image
322+
tags: ["${RELEASE}-node-image"]
320323
# REQUIRED: prodution repo to push the final image built
321324
prod:
322325
# REQUIRED: the image to push to
323326
image: quay.io/openshift-release-dev/ocp-v4.0-art-dev
324327
# REQUIRED: one or more tags to attach to the image
325328
tags:
326-
- "{RELEASE}-node-image"
327-
- "{RELEASE}-{TIMESTAMP}-node-image"
329+
- "${RELEASE}-node-image"
330+
- "${RELEASE}-${TIMESTAMP}-node-image"
331+
# OPTIONAL: whether to push in v2s2 format rather than OCI
332+
# Default to false if not specified
333+
v2s2: false

jobs/build-node-image.Jenkinsfile

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ lock(resource: "build-node-image") {
7373
// intermediary images before they are referenced in a multi-arch manifest.
7474
def registry_staging_tag = registry_staging_tags[0]
7575

76+
def v2s2 = pipecfg.ocp_node_builds.registries.prod.v2s2 ?: false
7677
// add any additional root CA cert before we do anything that fetches
7778
pipeutils.addOptionalRootCA()
7879

@@ -100,6 +101,7 @@ lock(resource: "build-node-image") {
100101
manifest_tag_staging: "${registry_staging_tag}",
101102
secret: "id=yumrepos,src=${yumrepos_file}", // notsecret (for secret scanners)
102103
from: build_from,
104+
v2s2: v2s2,
103105
extra_build_args: ["--security-opt label=disable", "--mount-host-ca-certs", "--force"])
104106
}
105107
}
@@ -115,6 +117,7 @@ lock(resource: "build-node-image") {
115117
manifest_tag_staging: "${registry_staging_tag}-extensions",
116118
secret: "id=yumrepos,src=${yumrepos_file}", // notsecret (for secret scanners)
117119
from: build_from,
120+
v2s2: v2s2,
118121
extra_build_args: ["--security-opt label=disable", "--mount-host-ca-certs",
119122
"--git-containerfile", "extensions/Dockerfile", "--force"])
120123
}

utils.groovy

+8-3
Original file line numberDiff line numberDiff line change
@@ -868,15 +868,18 @@ def build_remote_image(arches, commit, url, repo, tag, secret=None, from=None,
868868
return digest_list
869869
}
870870

871-
def push_manifest(digests, repo, manifest_tag) {
871+
def push_manifest(digests, repo, manifest_tag, v2s2) {
872872
def images = ""
873873
for (digest in digests) {
874874
images += " --image=docker://${repo}@${digest}"
875875
}
876876
def digest = ""
877877
def digest_file = "${manifest_tag}.digestfile"
878878
// save the digest to a file named after the tag we are pushing
879-
push_args = ["--write-digest-to-file", digest_file]
879+
def push_args = ["--write-digest-to-file", digest_file]
880+
if (v2s2) {
881+
push_args += ["--v2s2"]
882+
}
880883
// arbitrarily selecting the s390x builder; we don't run this
881884
// locally because podman wants user namespacing (yes, even just
882885
// to push a manifest...)
@@ -929,16 +932,18 @@ def build_and_push_image(params = [:]) {
929932
// src_commit: string -- Source Git commit.
930933
// src_url: string -- Source Git URL.
931934
// staging_repository: string -- Repository URL for the staging repo.
935+
// v2s2: bool -- Use docker v2s2 format rather than OCI. Default to false.
932936

933937
def secret = params.get('secret', "");
934938
def from = params.get('from', "");
935939
def manifest_digest = ""
936940
def extra_build_args = params.get('extra_build_args', "");
941+
def v2s2 = params.get('v2s2', false);
937942

938943
def digests = build_remote_image(params['arches'], params['src_commit'], params['src_url'], params['staging_repository'],
939944
params['image_tag_staging'], secret, from, extra_build_args)
940945
stage("Push Manifest") {
941-
manifest_digest = push_manifest(digests, params['staging_repository'], params['manifest_tag_staging'])
946+
manifest_digest = push_manifest(digests, params['staging_repository'], params['manifest_tag_staging'], v2s2)
942947
}
943948
return manifest_digest
944949
}

0 commit comments

Comments
 (0)