GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: accept filters and keep_storage in prune_builds by emranbm · Pull Request #3192 · docker/docker-py

Conversation

@emranbm

@emranbm emranbm commented Dec 3, 2023

Copy link
Copy Markdown
Contributor

Make the api.prune_builds method accept filters and keep-storage args to pass to the docker API. The API details can be found here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@emranbm
feat: accept filters and keep_storage in prune_builds
aeaac4c
Signed-off-by: Emran Batmanghelich <[email protected]>
milas
milas suggested changes Dec 4, 2023
View reviewed changes

@milas milas left a comment

Copy link
Copy Markdown
Contributor

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.

Thank you for the PR! I requested a couple of small changes:

  • Add the all parameter which was added to API v1.39 at the same time: https://docs.docker.com/engine/api/v1.39/#tag/Image/operation/BuildPrune
  • Add a programmatic API version check before using the new parameters

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

emranbm reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread docker/api/build.py Outdated

@utils.minimum_version('1.31')
def prune_builds(self):
def prune_builds(self, filters=None, keep_storage=None):

@milas milas Dec 4, 2023

Copy link
Copy Markdown
Contributor

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.

There's also all, which is a boolean and was added at the same time as filters and keep-storage - let's add that as well

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@emranbm emranbm Dec 4, 2023

Copy link
Copy Markdown
Contributor Author

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.

Done!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docker/api/build.py
Comment on lines +303 to +308
params = {}
if filters is not None:
params['filters'] = utils.convert_filters(filters)
if keep_storage is not None:
params['keep-storage'] = keep_storage
return self._result(self._post(url, params=params), True)

@milas milas Dec 4, 2023

Copy link
Copy Markdown
Contributor

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.

These args were added in API v1.39 - typically, we add a check for them, e.g.

if utils.version_lt(self._version, '1.39'):
    raise errors.InvalidVersion(
        '`keep-storage` arg only available for API version > 1.38'
    )

(if you look for utils.version_lt or utils.version_gte you'll see a bunch of examples - they're not 100% consistent so do whatever makes sense here, e.g. I'm fine if there's a single check if ANY of filters / keep_storage / any are not None since they were all added together in the same API version)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

emranbm reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@emranbm emranbm Dec 4, 2023

Copy link
Copy Markdown
Contributor Author

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.

Done!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@emranbm
emranbm requested a review from milas December 4, 2023 15:44
@emranbm
add all arg + check API version
a5b7ea3
Signed-off-by: Emran Batmanghelich <[email protected]>
@emranbm
emranbm force-pushed the main branch from 41a857e to a5b7ea3 Compare December 4, 2023 15:45
milas
milas suggested changes Dec 5, 2023
View reviewed changes

@milas milas left a comment

Copy link
Copy Markdown
Contributor

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.

Thanks for the speedy turn-around

LGTM, just needs a small fix from copy-paste 🙃

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docker/api/build.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

milas and others added 2 commits December 5, 2023 00:05
@milas
Update docker/api/build.py
3bb9f34
Signed-off-by: Milas Bowman <[email protected]>
@milas
Merge branch 'main' into main
03ff728
@emranbm

emranbm commented Dec 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Thanks for the speedy turn-around

LGTM, just needs a small fix from copy-paste 🙃

Oh sorry 😢
And thanks for your fix.
Now can it be merged?

milas reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

milas
milas approved these changes Dec 5, 2023
View reviewed changes
@milas
milas merged commit 3d0a3f1 into docker:main Dec 5, 2023
@milas

milas commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

Merged! Thanks for the PR! ❤️

emranbm reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@milas milas milas approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@emranbm @milas
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.