[action] [PR:24438] [build] Fix TRUSTED_GPG_URLS bug #24758
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.
Why I did it
There are two bugs in the
TRUSTED_GPG_URLSflow:The sonic-build-hooks Makefile logic that downloads the URLs in TRUSTED_GPG_URLS only reports a failure if the last URL in the list fails. Any other failures are silently ignored, and build proceeds.
The first URL in the current default flag value, https://packages.trafficmanager.net/debian/public_key.gpg, does not exist and seems like it has been broken for quite some time. This went unnoticed because of the first issue.
Work item tracking
How I did it
set -eat the beginning of the mini bash script responsible for downloading the URLs inTRUSTED_GPG_URLS, so fatal errors are noticed and reported.How to verify it
I've verified this fix under multiple scenarios:
make initwith no flagsThe single valid URL, https://packages.microsoft.com/keys/microsoft.asc, is downloaded successfully and build reports no errors
make initwithTRUSTED_GPG_URLS='https://packages.trafficmanager.net/debian/public_key.gpg,https://packages.microsoft.com/keys/microsoft.asc'Build fails as the first URL is broken. Note that this error was not caught in baseline code. The second URL is not downloaded.
make initwith the same URLs in opposite order (broken URL last)The first URL downloads. The second URL does not. The error is noticed and the build stops.
make initwith only the working URL (no other URLs or,in the variable)The key file downloads. Build reports success
make initwith only the broken URLThe 404 error is noticed and build aborts.
make initwith a URL that contains a non-existent domainThe connection failure is recognized and build fails.
make initwithTRUSTED_GPG_URLS=''No GPG keys are downloaded and the build proceeds
TRUSTED_GPG_URLSflag providedBuild was successful.
TRUSTED_GPG_URLS=''set at each stepBuild was successful.
Which release branch to backport (provide reason below if selected)
Needs to be backported as it's a build bug
Tested branch (Please provide the tested image version)
master @ d5bb539
Description for the changelog
[build] Fix TRUSTED_GPG_URLS bug
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)