classes/image-oci-umoci: Replace ":" in image file name
PATCH 1/1 classes/image-oci-umoci: Replace ":" in image file name
The OCI_IMAGE_TAG variable can contain a ":" if the user wants to give the image a name and a tag, as in:
OCI_IMAGE_TAG = "${IMAGE_BASENAME}:latest"However, while this is valid for tag name, the ":" is illegal in OCI image file names so replace it with "_" when naming the symlinks
--- classes/image-oci-umoci.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
classes/image-oci-umoci.inc +7 -3
@@ -105,6 +105,10 @@ IMAGE_CMD:oci() { fi umoci config --image $image_name:${OCI_IMAGE_TAG} --author ${OCI_IMAGE_AUTHOR_EMAIL} + # OCI_IMAGE_TAG may contain ":", but these are not allowed in OCI file + # names so replace them + image_tag="${@d.getVar("OCI_IMAGE_TAG").replace(":", "_")}" + # make a tar version of the image direcotry # 1) image_name.tar: compatible with oci tar format, blobs and rootfs # are at the top level. Can load directly from something like podman
@@ -118,13 +122,13 @@ IMAGE_CMD:oci() { tar -cf "$image_name-dir.tar" "$image_name" # create a convenience symlink - ln -sf "$image_name.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci.tar" - ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci-dir.tar" + ln -sf "$image_name.tar" "${IMAGE_BASENAME}-$image_tag-oci.tar" + ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-$image_tag-oci-dir.tar" fi # We could make this optional, since the bundle is directly runnable via runc rm -rf $image_bundle_name # This is the OCI image directory, which is technically the "image" as specified - ln -sf $image_name ${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci + ln -sf $image_name ${IMAGE_BASENAME}-$image_tag-oci }
Signature · 1 line
2.34.1
Quoted 8 lines · Joshua Watt
The
OCI_IMAGE_TAGvariable can contain a ":" if the user wants to give the image a name and a tag, as in:OCI_IMAGE_TAG = "${IMAGE_BASENAME}:latest"However, while this is valid for tag name, the ":" is illegal in OCI image file names so replace it with "_" when naming the symlinks
I haven't experimented with this yet, but as I mentioned on IRC some time ago, we really don't want to change the symlinks unless absolutely possible.
I'm still trying to understand the first RFC patch before getting into the question of the symlink.
But my question on this is ... who / what is declaring it illegal to have a : on the symlink name ? Is one of the OE/bitbake components ? umoci ? podman ? something else ?
Bruce
Quoted 50 lines
Signed-off-by Joshua Watt <[email protected]>--- classes/image-oci-umoci.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)classes/image-oci-umoci.inc +7
-4@@ -105,6 +105,10 @@ IMAGE_CMD:oci() { fi umoci config --image $image_name:${OCI_IMAGE_TAG} --author ${OCI_IMAGE_AUTHOR_EMAIL} + # OCI_IMAGE_TAG may contain ":", but these are not allowed in OCI file + # names so replace them + image_tag="${@d.getVar("OCI_IMAGE_TAG").replace(":", "_")}" + # make a tar version of the image direcotry # 1) image_name.tar: compatible with oci tar format, blobs and rootfs # are at the top level. Can load directly from something like podman@@ -118,13 +122,13 @@ IMAGE_CMD:oci() { tar -cf "$image_name-dir.tar" "$image_name" # create a convenience symlink - ln -sf "$image_name.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci.tar" - ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci-dir.tar" + ln -sf "$image_name.tar" "${IMAGE_BASENAME}-$image_tag-oci.tar" + ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-$image_tag-oci-dir.tar" fi # We could make this optional, since the bundle is directly runnable via runc rm -rf $image_bundle_name # This is the OCI image directory, which is technically the "image" as specified - ln -sf $image_name ${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci + ln -sf $image_name ${IMAGE_BASENAME}-$image_tag-oci } --2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8336): https://lists.yoctoproject.org/g/meta-virtualization/message/8336
Mute This Topic: https://lists.yoctoproject.org/mt/101758365/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
Quoted 14 lines · Bruce Ashfield
Quoted 8 lines · Joshua Watt
The
OCI_IMAGE_TAGvariable can contain a ":" if the user wants to give the image a name and a tag, as in:OCI_IMAGE_TAG = "${IMAGE_BASENAME}:latest"However, while this is valid for tag name, the ":" is illegal in OCI image file names so replace it with "_" when naming the symlinks
I haven't experimented with this yet, but as I mentioned on IRC some time ago, we really don't want to change the symlinks unless absolutely possible.
Quoted 7 lines
I'm still trying to understand the first RFC patch before getting into the question of the symlink.
But my question on this is ... who / what is declaring it illegal to have a : on the symlink name ? Is one of the OE/bitbake components ? umoci ? podman ? something else ?
Skopeo and podman both have this restriction. They allow specifying a tag inside an image with a :tag suffix, so you can't have an OCI file/directory named "foo:latest" because they assume that means a file/directory named "foo" and the tag "latest" inside it.
Quoted 70 lines
Bruce
classes/image-oci-umoci.inc IMAGE_CMD:oci() { · line 106
Quoted 13 lines
Signed-off-by Joshua Watt <[email protected]>--- classes/image-oci-umoci.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)classes/image-oci-umoci.inc +0
-0@@ -105,6 +105,10 @@ IMAGE_CMD:oci() { fi umoci config --image $image_name:${OCI_IMAGE_TAG} --author${OCI_IMAGE_AUTHOR_EMAIL}
classes/image-oci-umoci.inc IMAGE_CMD:oci() { · line 107
Quoted 2 lines
classes/image-oci-umoci.inc +1
-0+ # OCI_IMAGE_TAG may contain ":", but these are not allowed in OCIfile
classes/image-oci-umoci.inc IMAGE_CMD:oci() {
Quoted 5 lines
classes/image-oci-umoci.inc +3
-0+ # names so replace them + image_tag="${@d.getVar("OCI_IMAGE_TAG").replace(":", "_")}" + # make a tar version of the image direcotry # 1) image_name.tar: compatible with oci tar format, blobs androotfs
classes/image-oci-umoci.inc IMAGE_CMD:oci() { · line 113
Quoted 1 line
classes/image-oci-umoci.inc +0
-0# are at the top level. Can load directly from something likepodman
classes/image-oci-umoci.inc IMAGE_CMD:oci() { · line 121
Quoted 5 lines
classes/image-oci-umoci.inc +0
-1@@ -118,13 +122,13 @@ IMAGE_CMD:oci() { tar -cf "$image_name-dir.tar" "$image_name" # create a convenience symlink - ln -sf "$image_name.tar""${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci.tar"
classes/image-oci-umoci.inc IMAGE_CMD:oci() { · line 122
Quoted 1 line
classes/image-oci-umoci.inc +0
-1- ln -sf "$image_name-dir.tar""${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci-dir.tar"
classes/image-oci-umoci.inc IMAGE_CMD:oci() { · line 126
Quoted 2 lines
classes/image-oci-umoci.inc +2
-0+ ln -sf "$image_name.tar" "${IMAGE_BASENAME}-$image_tag-oci.tar" + ln -sf "$image_name-dir.tar""${IMAGE_BASENAME}-$image_tag-oci-dir.tar"
classes/image-oci-umoci.inc IMAGE_CMD:oci() { · line 129
Quoted 3 lines
classes/image-oci-umoci.inc +0
-0fi # We could make this optional, since the bundle is directlyrunnable via runc
classes/image-oci-umoci.inc IMAGE_CMD:oci() {
Quoted 3 lines
classes/image-oci-umoci.inc +0
-0rm -rf $image_bundle_name # This is the OCI image directory, which is technically the "image"as specified
Quoted 10 lines
classes/image-oci-umoci.inc +1
-2- ln -sf $image_name ${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci + ln -sf $image_name ${IMAGE_BASENAME}-$image_tag-oci } --2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#8336):https://lists.yoctoproject.org/g/meta-virtualization/message/8336
Quoted 3 lines
Mute This Topic: https://lists.yoctoproject.org/mt/101758365/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsubQuoted 2 lines
-=-=-=-=-=-=-=-=-=-=-=-
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
Quoted 22 lines · Joshua Watt
Quoted 18 lines · Bruce Ashfield
Quoted 8 lines · Joshua Watt
The
OCI_IMAGE_TAGvariable can contain a ":" if the user wants to give the image a name and a tag, as in:OCI_IMAGE_TAG = "${IMAGE_BASENAME}:latest"However, while this is valid for tag name, the ":" is illegal in OCI image file names so replace it with "_" when naming the symlinks
I haven't experimented with this yet, but as I mentioned on IRC some time ago, we really don't want to change the symlinks unless absolutely possible.
I'm still trying to understand the first RFC patch before getting into the question of the symlink.
Quoted 6 lines
Quoted 3 lines
But my question on this is ... who / what is declaring it illegal to have a : on the symlink name ? Is one of the OE/bitbake components ? umoci ? podman ? something else ?
Skopeo and podman both have this restriction. They allow specifying a tag inside an image with a :tag suffix, so you can't have an OCI file/directory named "foo:latest" because they assume that means a file/directory named "foo" and the tag "latest" inside it.
Fair enough. I'll run some of my own experiments with tags that are in the format you are using.
But given that this could cause issues with tags, I'm leaning towards taking the patch as-is.
bruce
Quoted 60 lines
Quoted 60 lines
Bruce
Quoted 42 lines
Signed-off-by Joshua Watt <[email protected]>--- classes/image-oci-umoci.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)classes/image-oci-umoci.inc +7
-4@@ -105,6 +105,10 @@ IMAGE_CMD:oci() { fi umoci config --image $image_name:${OCI_IMAGE_TAG} --author ${OCI_IMAGE_AUTHOR_EMAIL} + # OCI_IMAGE_TAG may contain ":", but these are not allowed in OCI file + # names so replace them + image_tag="${@d.getVar("OCI_IMAGE_TAG").replace(":", "_")}" + # make a tar version of the image direcotry # 1) image_name.tar: compatible with oci tar format, blobs and rootfs # are at the top level. Can load directly from something like podman@@ -118,13 +122,13 @@ IMAGE_CMD:oci() { tar -cf "$image_name-dir.tar" "$image_name" # create a convenience symlink - ln -sf "$image_name.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci.tar" - ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci-dir.tar" + ln -sf "$image_name.tar" "${IMAGE_BASENAME}-$image_tag-oci.tar" + ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-$image_tag-oci-dir.tar" fi # We could make this optional, since the bundle is directly runnable via runc rm -rf $image_bundle_name # This is the OCI image directory, which is technically the "image" as specified - ln -sf $image_name ${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci + ln -sf $image_name ${IMAGE_BASENAME}-$image_tag-oci } --2.34.1
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8336): https://lists.yoctoproject.org/g/meta-virtualization/message/8336
Mute This Topic: https://lists.yoctoproject.org/mt/101758365/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=---
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II