Skip to contentSkip to conversation

Revert "cri-o: install policy.json to avoid image pulling error"

PATCH In review Chen Qi 2 participants 6 messages Feb 20, 2023 – Feb 21, 2023

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/3 Revert "cri-o: install policy.json to avoid image pulling error"

Do NOT merge this patch. This revert-type patch is only an indication that the original patch on master-next should be dropped.

A follow-up patch to master-next will be sent to add policy.json to container-host-config.

This reverts commit 3a905978b2e6eb558072e65b2688a1ced5aa50a3.

---
 recipes-containers/cri-o/cri-o_git.bb | 2 --
 1 file changed, 2 deletions(-)
recipes-containers/cri-o/cri-o_git.bb +0 -2
index 57dfe8e..9467cf1 100644
@@ -98,8 +98,6 @@ do_install() {
     install -m 0644 ${S}/src/import/contrib/systemd/crio-wipe.service  ${D}${systemd_unitdir}/system/
 
     install -d ${D}${localstatedir}/lib/crio
-    install -d ${D}${sysconfdir}/containers
-    install -m 0644 ${S}/src/import/contrib/policy.json ${D}${sysconfdir}/containers
 }
 
 FILES:${PN}-config = "${sysconfdir}/crio/config/*"
Signature · 1 line
2.37.1
author
#1 lore raw

PATCH 2/3 container-host-config: provide /etc/containers/policy.json

The /etc/containers/policy.json[1] file is used to specify verification policy. For now, we can see it's used by both cri-o and skopeo. To avoid conflict, we use container-host-config to provide this file and make both skopeo and cri-o depend on it.

[1] https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md

---
 .../container-host-config/container-host-config.bb         | 2 ++
 .../container-host-config/policy.json                      | 7 +++++++
 recipes-containers/cri-o/cri-o_git.bb                      | 1 +
 recipes-containers/skopeo/skopeo_git.bb                    | 1 -
 4 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100755 recipes-containers/container-host-config/container-host-config/policy.json
recipes-containers/container-host-config/container-host-config.bb +2 -0
index c762dea..c2f17bf 100644
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384
 SRC_URI = " \
     file://storage.conf \
     file://registries.conf \
+    file://policy.json \
 "
 
 do_install() {
@@ -15,4 +16,5 @@ do_install() {
 
 	install ${WORKDIR}/storage.conf ${D}/${sysconfdir}/containers/storage.conf
 	install ${WORKDIR}/registries.conf ${D}/${sysconfdir}/containers/registries.conf
+	install ${WORKDIR}/policy.json ${D}/${sysconfdir}/containers/policy.json
 }
recipes-containers/container-host-config/container-host-config/policy.json new file +7 -0
new file mode 100755
index 0000000..bb26e57
@@ -0,0 +1,7 @@
+{
+    "default": [
+        {
+            "type": "insecureAcceptAnything"
+        }
+    ]
+}
recipes-containers/cri-o/cri-o_git.bb +1 -0
index 9467cf1..2ae3303 100644
@@ -57,6 +57,7 @@ inherit systemd
 inherit go
 inherit goarch
 inherit pkgconfig
+inherit container-host
 
 EXTRA_OEMAKE="BUILDTAGS=''"
 
recipes-containers/skopeo/skopeo_git.bb +0 -1
index 66168ca..4d062ed 100644
@@ -82,7 +82,6 @@ do_install() {
 	install -d ${D}/${sysconfdir}/containers
 
 	install ${S}/src/import/bin/skopeo ${D}/${sbindir}/
-	install ${S}/src/import/default-policy.json ${D}/${sysconfdir}/containers/policy.json
 }
 
 do_install:append:class-native() {
Signature · 1 line
2.37.1
author
#3 lore raw

PATCH 3/3 container-host-config: extend to native and nativesdk

In reply to Chen Qi

skopeo rdepends on it, and skopeo has been extended to native and nativesdk, so container-host-config needs also be extended.

---
 .../container-host-config/container-host-config.bb              | 2 ++
 1 file changed, 2 insertions(+)
recipes-containers/container-host-config/container-host-config.bb +2 -0
index c2f17bf..80abddf 100644
@@ -18,3 +18,5 @@ do_install() {
 	install ${WORKDIR}/registries.conf ${D}/${sysconfdir}/containers/registries.conf
 	install ${WORKDIR}/policy.json ${D}/${sysconfdir}/containers/policy.json
 }
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.37.1
#2 lore raw

Re: [meta-virtualization][master-next][PATCH 2/3] container-host-config: provide /etc/containers/policy.json

In reply to Chen Qi

Good catch, I had meant to include this in the configuration package and forgot.

This is now staged on master-next.

Bruce

In message: [meta-virtualization][master-next][PATCH 2/3] container-host-config: provide /etc/containers/policy.json

Quoted 84 lines · on 19/02/2023 Chen Qi wrote:

The /etc/containers/policy.json[1] file is used to specify verification policy. For now, we can see it's used by both cri-o and skopeo. To avoid conflict, we use container-host-config to provide this file and make both skopeo and cri-o depend on it.

[1] https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md

---
 .../container-host-config/container-host-config.bb         | 2 ++
 .../container-host-config/policy.json                      | 7 +++++++
 recipes-containers/cri-o/cri-o_git.bb                      | 1 +
 recipes-containers/skopeo/skopeo_git.bb                    | 1 -
 4 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100755 recipes-containers/container-host-config/container-host-config/policy.json
recipes-containers/container-host-config/container-host-config.bb +2 -0
index c762dea..c2f17bf 100644
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384
 SRC_URI = " \
     file://storage.conf \
     file://registries.conf \
+    file://policy.json \
 "
 
 do_install() {
@@ -15,4 +16,5 @@ do_install() {
 
 	install ${WORKDIR}/storage.conf ${D}/${sysconfdir}/containers/storage.conf
 	install ${WORKDIR}/registries.conf ${D}/${sysconfdir}/containers/registries.conf
+	install ${WORKDIR}/policy.json ${D}/${sysconfdir}/containers/policy.json
 }
recipes-containers/container-host-config/container-host-config/policy.json new file +7 -0
new file mode 100755
index 0000000..bb26e57
@@ -0,0 +1,7 @@
+{
+    "default": [
+        {
+            "type": "insecureAcceptAnything"
+        }
+    ]
+}
recipes-containers/cri-o/cri-o_git.bb +1 -0
index 9467cf1..2ae3303 100644
@@ -57,6 +57,7 @@ inherit systemd
 inherit go
 inherit goarch
 inherit pkgconfig
+inherit container-host
 
 EXTRA_OEMAKE="BUILDTAGS=''"
 
recipes-containers/skopeo/skopeo_git.bb +0 -1
index 66168ca..4d062ed 100644
@@ -82,7 +82,6 @@ do_install() {
 	install -d ${D}/${sysconfdir}/containers
 
 	install ${S}/src/import/bin/skopeo ${D}/${sbindir}/
-	install ${S}/src/import/default-policy.json ${D}/${sysconfdir}/containers/policy.json
 }
 
 do_install:append:class-native() {
Signature · 11 lines
2.37.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7883): https://lists.yoctoproject.org/g/meta-virtualization/message/7883
Mute This Topic: https://lists.yoctoproject.org/mt/97080776/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#4 lore raw

Re: [meta-virtualization][master-next][PATCH 3/3] container-host-config: extend to native and nativesdk

In reply to Chen Qi

I had also meant to include this in my original recipe, but cleaned too much up!

This is now staged on master-next.

Bruce

In message: [meta-virtualization][master-next][PATCH 3/3] container-host-config: extend to native and nativesdk

Quoted 31 lines · on 19/02/2023 Chen Qi wrote:

skopeo rdepends on it, and skopeo has been extended to native and nativesdk, so container-host-config needs also be extended.

---
 .../container-host-config/container-host-config.bb              | 2 ++
 1 file changed, 2 insertions(+)
recipes-containers/container-host-config/container-host-config.bb +2 -0
index c2f17bf..80abddf 100644
@@ -18,3 +18,5 @@ do_install() {
 	install ${WORKDIR}/registries.conf ${D}/${sysconfdir}/containers/registries.conf
 	install ${WORKDIR}/policy.json ${D}/${sysconfdir}/containers/policy.json
 }
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 11 lines
2.37.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7882): https://lists.yoctoproject.org/g/meta-virtualization/message/7882
Mute This Topic: https://lists.yoctoproject.org/mt/97080775/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#5 lore raw
In reply to Chen Qi

dropped.

Bruce

In message: [meta-virtualization][master-next][PATCH 1/3] Revert "cri-o: install policy.json to avoid image pulling error"

Quoted 39 lines · on 19/02/2023 Chen Qi wrote:

Do NOT merge this patch. This revert-type patch is only an indication that the original patch on master-next should be dropped.

A follow-up patch to master-next will be sent to add policy.json to container-host-config.

This reverts commit 3a905978b2e6eb558072e65b2688a1ced5aa50a3.

---
 recipes-containers/cri-o/cri-o_git.bb | 2 --
 1 file changed, 2 deletions(-)
recipes-containers/cri-o/cri-o_git.bb +0 -2
index 57dfe8e..9467cf1 100644
@@ -98,8 +98,6 @@ do_install() {
     install -m 0644 ${S}/src/import/contrib/systemd/crio-wipe.service  ${D}${systemd_unitdir}/system/
 
     install -d ${D}${localstatedir}/lib/crio
-    install -d ${D}${sysconfdir}/containers
-    install -m 0644 ${S}/src/import/contrib/policy.json ${D}${sysconfdir}/containers
 }
 
 FILES:${PN}-config = "${sysconfdir}/crio/config/*"
Signature · 11 lines
2.37.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7881): https://lists.yoctoproject.org/g/meta-virtualization/message/7881
Mute This Topic: https://lists.yoctoproject.org/mt/97080774/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-