Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.4-stable] backport: Carry media type through download verify. #3710

Conversation

OhmSpectator
Copy link
Member

This PR is a backport of PR #3706.
It stores the Blob media type as a part of the verified status filename so it can be restored after reboot.

deitch and others added 5 commits January 23, 2024 18:32
Implemented a feature to save the media type hashed in the
verifier filename. This enhancement is used in both config and
status, ensuring that the media type is persistently available and
survives reboots. Modified several functions in verifier.go to
include media type in the filename generation. Also updated
related structures in verifiertypes.go to include the media type.

Issue: lf-edge#3704

Signed-off-by: Avi Deitcher <avi@deitcher.net>
(cherry picked from commit c1a8e94)
This commit introduces new unit tests in verifier_test.go for the verifier
module. The tests focus on ensuring that media types, specifically
'application/vnd.docker.distribution.manifest.v2+json', are correctly encoded
into file names and then accurately decoded back into the VerifyImageStatus
structure.

Issue: lf-edge#3704

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
Signed-off-by: Avi Deitcher <avi@deitcher.net>
(cherry picked from commit 41a9f96)
This commit updates the verifier module, specifically in `verifier.go`, to
enhance the handling of verified files that lack a MediaType.

Changes made:

1. In `verifyImageStatusFromVerifiedImageFile`, a check is added for the
   absence of MediaType in the file name. If MediaType is missing, a warning is
   logged, and the function returns `nil` to initiate a redownload process for the
   image.
2. In `populateInitialStatusFromVerified`, we handle the scenario where
   `status` is `nil` (indicating a missing MediaType and potentially corrupted
   file). The verifier now logs this situation, checks for the file's existence,
   and removes the file if found. This step prevents the population of blob status
   for these files and ensures that only complete and verified files are

Issue: lf-edge#3704

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
(cherry picked from commit e03b830)
Add trace logging for mediaType recovery in
verifyImageStatusFromVerifiedImageFile.

Change logging level for removing corrupted files in
populateInitialStatusFromVerified to Tracef for consistent traceability.

Issue: lf-edge#3704

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
(cherry picked from commit 633010f)
Introduces a new test in verifier_test.go to handle filenames without a media
type, as might be generated by older EVE versions. Ensures correct processing
of such filenames by the `verifyImageStatusFromVerifiedImageFile` function.

Issue: lf-edge#3704

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
(cherry picked from commit 25db0d8)
@OhmSpectator
Copy link
Member Author

Strange that a not-related uint test fails:

    workerpool_test.go:352: 
        	Error Trace:	/go/src/github.com/lf-edge/eve/pkg/pillar/worker/workerpool_test.go:352
        	Error:      	Not equal: 
        	            	expected: 3
        	            	actual  : 4
        	Test:       	TestGC

@milan-zededa
Copy link
Contributor

Strange that a not-related uint test fails:

This UT fails from time to time

@eriknordmark eriknordmark merged commit 867bb59 into lf-edge:10.4-stable Jan 25, 2024
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants