Skip to content
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

nexus-cli image delete and keep option (wrong sorting) #33

Open
jakubek opened this issue Aug 29, 2018 · 4 comments
Open

nexus-cli image delete and keep option (wrong sorting) #33

jakubek opened this issue Aug 29, 2018 · 4 comments

Comments

@jakubek
Copy link

jakubek commented Aug 29, 2018

I had registry with 190 tags for image, tags were generated automagically and images were pushed with incremented version number from 1 to 190.

nexus@reg:~$ ./nexus-cli image tags -n testimage
1
10
100
101
102
103
104
105
106
107
108
109
11
110
111
112
113
114
115
116
117
118
119
12
120
121
122
123
...

I have decided to remove old images and keep only last 20:

nexus@reg:~$ ./nexus-cli image delete -n testimage -k 20

and the effect is:

nexus@reg:~$ ./nexus-cli image tags -n testimage
81
82
83
84
85
86
87
88
89
9
90
91
92
93
94
95
96
97
98
99
There are 20 images for testimage

Nexus-cli version:
nexus@reg:~$ ./nexus-cli --version Nexus CLI version 1.0.0-beta

@hkamalakannan
Copy link

That is because the code is sorting images by name (string comparison) so 100 will appear before 90 and be deleted. Believe pull request #29 might resolve it.

@denis111
Copy link

So, when we can expect it to be merged?

@Basster
Copy link

Basster commented Sep 11, 2020

Its even worse.

I had

nexus-cli image tags -name ff-cfp
latest
v13
v14
v16
v17
v18
v19
v21
v23
v25
v27
v31
v32
v33
v36
v37
v38
v39
v41
v42
v43
v46
v50
v51
There are 24 images for ff-cfp

And did a:

nexus-cli image delete --name ff-cfp --keep 5
ff-cfp:latest image will be deleted ...
ff-cfp:latest has been successful deleted
ff-cfp:v13 image will be deleted ...
ff-cfp:v13 has been successful deleted
ff-cfp:v14 image will be deleted ...
ff-cfp:v14 has been successful deleted
ff-cfp:v16 image will be deleted ...

And it deleted my freshly created latest tag immediately, This makes the whole --keep option useless!

@zt-sv
Copy link

zt-sv commented Oct 29, 2021

Looks like the repository is not maintained already.

I fork the repo and fix sorting issue by made image sorting by last modified date. If you still need fix, you can get build binaries from my repo: https://github.com/13rentgen/nexus-cli/releases/tag/v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants