Commit f2af6df
committed
podvm: fail loud when oras resolve returns empty digest
pull_agent_artifact and pull_gc_artifact in
src/cloud-api-adaptor/podvm/Makefile.inc both call `oras resolve
$OCI_IMAGE:$tag` and capture the result in OCI_DIGEST via make's
$(shell) function. When the registry does not have the requested tag
(for example, when versions.yaml pins a GUEST_COMPONENTS_REF or
KATA_REF that does not have a corresponding published `<sha>-<arch>`
or `<sha>-<tee>_<arch>` artifact), `oras resolve` exits non-zero and
prints nothing to stdout. make captures the empty stdout into
OCI_DIGEST, then constructs `OCI_REF := $(OCI_IMAGE)@` (trailing @ with
no digest), and the downstream `oras pull` either fails opaquely or --
depending on local cache state -- pulls a stale layer from a previous
successful build at a different commit. The resulting PodVM image then
contains guest-components or kata-agent binaries that do not match the
SHAs declared in versions.yaml, with no warning at build time.
This is real. It was the underlying cause of multi-day diagnosis effort
when a PodVM AMI built from CAA v0.20.0 contained an attestation-agent
binary that spoke an older wire protocol than the commit pinned in
versions.yaml shipped, leading to KBS-side `RcarAuthFailed: deserialize
Request - missing field 'version'` rejections. The AMI build succeeded
silently; the failure surfaced 1+ hours later at attestation handshake
time, in a separate component (Trustee).
This change adds a single guard between `oras resolve` and the
subsequent `OCI_REF` construction: the shell output is wrapped in
$(strip ...) (defensive against whitespace), and if OCI_DIGEST is
empty afterwards, make's $(error) function aborts the build
immediately with a message naming the missing image:tag and pointing
at the versions.yaml field to investigate. oras's own stderr is left
visible (no `2>/dev/null` redirection) so users see the underlying
network / auth / 404 details alongside the make-level abort message.
Behavior change: builds that previously produced a stale-binary PodVM
image now fail at the make level with a clear error. Builds whose
versions.yaml pins resolve correctly are unchanged. No CI workflow,
script, or other consumer of this Makefile.inc relies on the silent-
fallback behavior.
A follow-up could add a CI workflow that pre-validates all
versions.yaml::oci.*.reference SHAs resolve in their registries before
a release tag is cut, but that is out of scope for this minimal-diff
fix.
Signed-off-by: Abhishek Agrawal <abhishek.yours4@gmail.com>1 parent 02bb592 commit f2af6df
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
117 | | - | |
| 118 | + | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| |||
0 commit comments