-
Notifications
You must be signed in to change notification settings - Fork 582
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
spread, tests: use prebuilt gojq, add simple tool for fetching files #14738
base: master
Are you sure you want to change the base?
spread, tests: use prebuilt gojq, add simple tool for fetching files #14738
Conversation
Add a trivial script that can be used as a replacement for wget/curl if we're only interested in fetching a file. Signed-off-by: Maciej Borzecki <[email protected]>
Signed-off-by: Maciej Borzecki <[email protected]>
We need gojq for the tests. Make sure it is avaialble. Signed-off-by: Maciej Borzecki <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #14738 +/- ##
==========================================
+ Coverage 78.95% 79.03% +0.08%
==========================================
Files 1084 1087 +3
Lines 146638 147681 +1043
==========================================
+ Hits 115773 116722 +949
- Misses 23667 23730 +63
- Partials 7198 7229 +31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Signed-off-by: Maciej Borzecki <[email protected]>
tests are passing: https://paste.ubuntu.com/p/MCkYcNJhNc/ |
Will this fix the broken CI on core-base as well? (see https://github.com/canonical/core-base/actions/runs/11907759283/job/33182571839?pr=287) |
import logging | ||
import datetime | ||
from urllib import request | ||
from urllib.parse import urlparse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're using urllib, is there a reason why not to use urllib.request.urlretrieve
? Then the code would just be:
from urllib import request
request.urlretrieve(opts.URL, opts.output)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use urlretrieve, since it's handling a bit more errors.
Signed-off-by: Maciej Borzecki <[email protected]>
w8, how did core-base end up using gojq? |
Looks like older Python has stronger opinion on whether ENOENT when removing NamedTempFile matters |
Signed-off-by: Maciej Borzecki <[email protected]>
Signed-off-by: Maciej Borzecki <[email protected]>
It is not viable to build gojq in some of the test environments (eg. beta validation), so use a prebuilt binary from github.
Since we do not always have a wget or curl available on the host, add a simplistic replacement which is only capable of fetching files.
NOTE this doesn't solve the case for armhf yet, we do not have prebuilt binaries available there.
Related: SNAPDENG-34224