Skip to content

Commit 41133ea

Browse files
committed
cmd-remote-build-container: add --add-openshift-build-labels
Currently, `oc` looks for non-standard labels for git information, which it then places in e.g. `image-references` in the release payload. Ideally `oc` would also check for the standard `org.opencontainers.image.{revision,source}` labels too for this purpose but this assumption is wired in a bunch of places so let's just conform for now to it. Add a new option to inject these labels. This can then be used when building the node image extensions image. In turn, this makes the release controller page for a release have working links for our images to the openshift/os commit they were built from, just like the other images.
1 parent ec20f34 commit 41133ea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/cmd-remote-build-container

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ def main():
166166
# Add some information about the commit to labels for the container
167167
args.labels.append(f"org.opencontainers.image.revision={commit}")
168168
args.labels.append(f"org.opencontainers.image.source={args.git_url}")
169+
if args.add_openshift_build_labels:
170+
args.labels.append(f"io.openshift.build.commit.id={commit}")
171+
args.labels.append(f"io.openshift.build.source-location={args.git_url}")
169172
# If a tag wasn't passed then use the arch + shortcommit
170173
if not args.tag:
171174
args.tag = f"{args.arch}-{shortcommit}"
@@ -257,6 +260,9 @@ Examples:
257260
parser.add_argument(
258261
'--label', dest="labels", default=[], action='append',
259262
required=False, help='Add image label(s)')
263+
parser.add_argument(
264+
'--add-openshift-build-labels', required=False, action='store_true',
265+
help='Add io.openshift.build.* labels with git information')
260266
parser.add_argument(
261267
'--mount-host-ca-certs', required=False, action='store_true',
262268
help='Mount the CA certificate from the remote host')

0 commit comments

Comments
 (0)