From: "'Clara Kowalsky' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, Clara Kowalsky <clara.kowalsky@siemens.com>
Subject: [PATCH v3 1/2] container_fetcher: Fix missing checksum warning
Date: Fri, 27 Jun 2025 08:53:35 +0200 [thread overview]
Message-ID: <20250627065336.2910069-1-clara.kowalsky@siemens.com> (raw)
In case only a tag is specified for a container image in the SRC_URI and
no digest, a warning should be issued with the recommendation to add the
digest of the container image.
So far, we were presenting in the warning the digest of the
architecture-specific image that happened to be fetched first. However,
we actually want to show the multi-arch manifest digest rather than the
architecture-specific one.
In addition, reading the manifest.json does not work at this point
anyway, as skopeo has already packed it into a Docker archive.
Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/lib/container_fetcher.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/meta/lib/container_fetcher.py b/meta/lib/container_fetcher.py
index 0d659154..16467abb 100644
--- a/meta/lib/container_fetcher.py
+++ b/meta/lib/container_fetcher.py
@@ -6,6 +6,7 @@
import oe.path
import os
import tempfile
+import json
from bb.fetch2 import FetchMethod
from bb.fetch2 import logger
from bb.fetch2 import MissingChecksumEvent
@@ -60,16 +61,17 @@ class Container(FetchMethod):
if ud.digest:
return
- checksum = bb.utils.sha256_file(ud.localpath + "/manifest.json")
- checksum_line = f"SRC_URI = \"{ud.url};digest=sha256:{checksum}\""
+ inspect_output = runfetchcmd(f"skopeo inspect docker://{ud.container_name}:{ud.tag}", d, True)
+ digest = json.loads(inspect_output)["Digest"]
+ checksum_line = f'SRC_URI = "{ud.url};digest={digest}"'
strict = d.getVar("BB_STRICT_CHECKSUM") or "0"
# If strict checking enabled and neither sum defined, raise error
if strict == "1":
raise NoChecksumError(checksum_line)
- checksum_event = {"sha256sum": checksum}
+ checksum_event = {"sha256sum": digest}
bb.event.fire(MissingChecksumEvent(ud.url, **checksum_event), d)
if strict == "ignore":
@@ -77,7 +79,7 @@ class Container(FetchMethod):
# Log missing digest so user can more easily add it
logger.warning(
- f"Missing checksum for '{ud.localpath}', consider using this " \
+ f"Missing checksum for '{ud.url}', consider using this " \
f"SRC_URI in the recipe:\n{checksum_line}")
def unpack(self, ud, rootdir, d):
--
2.49.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250627065336.2910069-1-clara.kowalsky%40siemens.com.
next reply other threads:[~2025-06-27 6:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 6:53 'Clara Kowalsky' via isar-users [this message]
2025-06-27 6:53 ` [PATCH v3 2/2] container_fetcher: Verify that tag and digest match 'Clara Kowalsky' via isar-users
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250627065336.2910069-1-clara.kowalsky@siemens.com \
--to=isar-users@googlegroups.com \
--cc=clara.kowalsky@siemens.com \
--cc=jan.kiszka@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox