-
Notifications
You must be signed in to change notification settings - Fork 2k
docker manifest rm command to remove manifest list draft from local storage
#2449
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
Conversation
cli/command/manifest/rm.go
Outdated
| Short: "Delete a manifest list from local storage", | ||
| Args: cli.ExactArgs(1), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| opts.target = args[0] |
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.
Should it accept multiple manifests? (i.e., docker manifest rm one two three) other rm commands support multiple manifests so it would probably make sense to accept that for this command as well
|
Any view on when this might merge? This is exactly the functionality we're looking for to ensure that old artifacts are cleaned if there is an issue with previous jobs |
cli/command/manifest/rm.go
Outdated
| return err | ||
| } | ||
|
|
||
| manifests, err := dockerCli.ManifestStore().GetList(targetRef) |
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.
question: I wonder why we search the manifest list, couldn't we just remove it and return Remove error?
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.
sorry, naive copy-paste.
fixed 30466e2
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.
actually in working on supporting multiple args it turns out that dockerCli.ManifestStore().GetList(targetRef) is useful because dockerCli.ManifestStore().Remove(targetRef) will fail silently when targetRef does not exist.
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 think the adding the rm subcommand is fine, but this PR needs some tests to be merged 👍
|
Hi everyone, I am really not a Go dev, this PR was mostly a proof-of-concept. I can try writing some tests... |
Really appreciate that. |
|
FYI for my own use cases I found |
Does |
|
Yes. |
Codecov Report
@@ Coverage Diff @@
## master #2449 +/- ##
==========================================
+ Coverage 58.59% 58.61% +0.02%
==========================================
Files 296 297 +1
Lines 21360 21387 +27
==========================================
+ Hits 12516 12537 +21
- Misses 7931 7935 +4
- Partials 913 915 +2 |
docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
0e7c04f to
ccdc4ed
Compare
docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
|
Happy to say that the tooling was surprisingly easy to pick up!
|
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, thanks @jennydaman 👍
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.
code changes LGTM, but could you squash the commits? Let me know if you need instructions on doing so 🤗
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 found problems in bash completion, please fix.
docker#2449 (review) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
Squashed commit of the following: commit b9ef85e Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Mon Sep 14 21:39:57 2020 -0400 Fix bash completion docker#2449 (review) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 8c46bd6 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 01:48:12 2020 -0400 Add tests for docker manifest rm Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 7e3d9a9 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 00:55:37 2020 -0400 docker manifest rm multiple args Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 30466e2 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 00:01:20 2020 -0400 No need to search before Remove docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit ccdc4ed Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sat Sep 12 23:42:41 2020 -0400 Completion should also handle --help docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit ed260af Merge: 46c61d8 2955ece Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sat Sep 12 23:31:54 2020 -0400 Merge branch 'master' into manifest-rm commit 46c61d8 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:53:33 2020 -0400 Remove extra space Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 6d31d26 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:15:21 2020 -0400 Bash completion for `docker manifest rm` Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 3c8c843 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:05:50 2020 -0400 Frankenstein a `docker manifest rm` command Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
8c46bd6 to
29dcc37
Compare
|
@albers bash completion fixed @thaJeztah I tried squash, I think it's correct-ish? |
Looks like something we should fix in a follow-up. I think it would be good to have |
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.
| targetRef, refErr := normalizeReference(target) | ||
| if refErr != nil { | ||
| errs = append(errs, refErr.Error()) | ||
| continue |
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.
We could probably add a -f / --force option to switch between "failing immediately" if any of the references is invalid and/or doesn't exist, or only printing the error, but still completing the command successfully (see #2678 and #2677)
Not a blocker; this command is still experimental, so I'm ok on improving that in a follow-up
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.
this command is still experimental
--force isn't ubiquitous either way
docker network rm --help
Usage: docker network rm NETWORK [NETWORK...]
Remove one or more networks
Aliases:
rm, remove
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 think for network, there had been some discussion, but the problem was that --force would also imply "if it's in use", which could mean that containers would have to be (automatically) detached from the network.
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 agree with your proposal @thaJeztah, and also ok to improve that in a follow-up 👍
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
Squashed commit of the following: commit b9ef85e Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Mon Sep 14 21:39:57 2020 -0400 Fix bash completion docker#2449 (review) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 8c46bd6 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 01:48:12 2020 -0400 Add tests for docker manifest rm Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 7e3d9a9 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 00:55:37 2020 -0400 docker manifest rm multiple args Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 30466e2 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 00:01:20 2020 -0400 No need to search before Remove docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit ccdc4ed Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sat Sep 12 23:42:41 2020 -0400 Completion should also handle --help docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit ed260af Merge: 46c61d8 2955ece Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sat Sep 12 23:31:54 2020 -0400 Merge branch 'master' into manifest-rm commit 46c61d8 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:53:33 2020 -0400 Remove extra space Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 6d31d26 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:15:21 2020 -0400 Bash completion for `docker manifest rm` Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 3c8c843 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:05:50 2020 -0400 Frankenstein a `docker manifest rm` command Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
29dcc37 to
185d712
Compare
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, thanks!
Squashed commit of the following:
commit b9ef85e74833ba405f68cfc20989c69d64bac4e9
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Mon Sep 14 21:39:57 2020 -0400
Fix bash completion
docker/cli#2449 (review)
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
commit 8c46bd6e6ed151bb43865c8b1d79c00fd62e4345
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Sun Sep 13 01:48:12 2020 -0400
Add tests for docker manifest rm
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
commit 7e3d9a9bc60e44d96953093fa0b1bc3397ca7813
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Sun Sep 13 00:55:37 2020 -0400
docker manifest rm multiple args
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
commit 30466e28d28f6722053c5a232e99ddbae8222715
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Sun Sep 13 00:01:20 2020 -0400
No need to search before Remove
docker/cli#2449 (comment)
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
commit ccdc4ed0a620cf8c9ec6ecc6804d1a45f7c61be5
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Sat Sep 12 23:42:41 2020 -0400
Completion should also handle --help
docker/cli#2449 (comment)
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
commit ed260afa71a4f8feb6550f79692e47ad7430d786
Merge: 46c61d85e9 2955ece024
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Sat Sep 12 23:31:54 2020 -0400
Merge branch 'master' into manifest-rm
commit 46c61d85e973cc9fdd28d42db9ecebe373e9b942
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Fri Apr 17 21:53:33 2020 -0400
Remove extra space
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
commit 6d31d26c10e8d395ab08561cdb9b29829bb4bd91
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Fri Apr 17 21:15:21 2020 -0400
Bash completion for `docker manifest rm`
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
commit 3c8c843deb2f751a5f51ee6fcaa75da2a4525d99
Author: Jennings Zhang <jenni_zh@protonmail.com>
Date: Fri Apr 17 21:05:50 2020 -0400
Frankenstein a `docker manifest rm` command
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>
Upstream-commit: 185d71262a56dfb2d5c11d49441f6acb729055eb
Component: cli
Squashed commit of the following: commit b9ef85e Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Mon Sep 14 21:39:57 2020 -0400 Fix bash completion docker#2449 (review) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 8c46bd6 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 01:48:12 2020 -0400 Add tests for docker manifest rm Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 7e3d9a9 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 00:55:37 2020 -0400 docker manifest rm multiple args Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 30466e2 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sun Sep 13 00:01:20 2020 -0400 No need to search before Remove docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit ccdc4ed Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sat Sep 12 23:42:41 2020 -0400 Completion should also handle --help docker#2449 (comment) Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit ed260af Merge: 46c61d8 2955ece Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Sat Sep 12 23:31:54 2020 -0400 Merge branch 'master' into manifest-rm commit 46c61d8 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:53:33 2020 -0400 Remove extra space Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 6d31d26 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:15:21 2020 -0400 Bash completion for `docker manifest rm` Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> commit 3c8c843 Author: Jennings Zhang <jenni_zh@protonmail.com> Date: Fri Apr 17 21:05:50 2020 -0400 Frankenstein a `docker manifest rm` command Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com> Signed-off-by: Jennings Zhang <jenni_zh@protonmail.com>

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

- What I did
Made a typo and wanted to delete my manifest from local storage, yet there was no easy way to do so without using
docker manifest push --purge.I implemented a new sub-command
docker manifest rm- How I did it
tbh I never programmed in Go before, so I copied and pasted
push.gotorm.goand kept deleting lines until it would compile.- How to verify it
- Description for the changelog
Add sub-command
docker manifest rm- A picture of a cute animal (not mandatory but encouraged)