-
Notifications
You must be signed in to change notification settings - Fork 159
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
Merged
eriknordmark
merged 5 commits into
lf-edge:10.4-stable
from
OhmSpectator:backport/10.4/carry-media-type-through-download-verify
Jan 25, 2024
Merged
[10.4-stable] backport: Carry media type through download verify. #3710
eriknordmark
merged 5 commits into
lf-edge:10.4-stable
from
OhmSpectator:backport/10.4/carry-media-type-through-download-verify
Jan 25, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)
Strange that a not-related uint test fails:
|
This UT fails from time to time |
milan-zededa
approved these changes
Jan 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.