-
Notifications
You must be signed in to change notification settings - Fork 24
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
Replace requests with urllib in prune_images script #88
Conversation
Skipping CI for Draft Pull Request. |
52dab51
to
bcf330f
Compare
STONEBLD-1785 * Part of the prune_images script is rewritten with urllib instead of requests. * Test code is also rewritten so that prune_images script uses all builtin libraries for execution and development. No write operation is required for running the script during the cronjob execution. * Additional tests are added. Run tests: cd config/registry_image_pruner/image_pruner/ python3.9 test_prune_images.py Signed-off-by: Chenxiong Qi <[email protected]>
This makes mypy happy. Signed-off-by: Chenxiong Qi <[email protected]>
Signed-off-by: Chenxiong Qi <[email protected]>
Signed-off-by: Chenxiong Qi <[email protected]>
bcf330f
to
18408e7
Compare
if not repos: | ||
LOGGER.debug("No image repository is found.") | ||
break |
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.
Do we want to break
when there are no repositories? It looks like the script previously didn't do that
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.
The script didn't do that previously. It could call the process_repositories
with an empty list of repos or None
. I don't want that. :)
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.
I previously chose that approach because it felt more pythonic to me
as the first line of the function
for repo in repos:
would just ignore empty repos. This way we have to have a condition and a break, but if the images can really be None
then this approach make sense
I know you already did the work, but I would have prefered if we just had an image with the requests library in our new dockerfiles repos |
These separate unit tests are based on the previous tests. Signed-off-by: Chenxiong Qi <[email protected]>
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.
LGTM 👍
6a49cf6
to
61598ec
Compare
* Address review comment by replacing name image with tag. * Remove regex compilation flag to avoid confusion. Previous regex match did not use it. * Remove unused import. Signed-off-by: Chenxiong Qi <[email protected]>
61598ec
to
05d3a43
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
STONEBLD-1785
This replacement ensures no write operation to the rootFS happens during the job execution.
Major changes:
Run tests:
cd config/registry_image_pruner/image_pruner/ python3.9 test_prune_images.py
In addition, two small refactors are made and a GitHub workflow action is added to run the tests in CI.