moooofly / harbor-go-client

A CLI tool for the Docker Registry Harbor. This project offer a command-line interface to the Harbor API, you can use it to manager your users, projects, repositories, etc.
MIT License
76 stars 10 forks source link

rp_tags command can not get "tags RP Analysing" output #21

Open mr1way opened 6 years ago

mr1way commented 6 years ago

I login Harbor and run /harbor-go-client rp_tags -d 0 -m 2000 -n xxx I get this output : [root@localhost /]# /harbor-go-client rp_tags -d 0 -m 200 -n ths/website-datacenter-back

=============================== \== Start tags RP Analysing ==


==> GET http://xxx.xxx.xxx/api/search?q=ths/website-datacenter-back ==> only on Repo [ths/website-datacenter-back], max-days-untouched: 0 max-keep-num-after-Ndays: 200

My Harbor version : 1.5.3 & 1.3.0

It seems that the data returned by the api has changed.

moooofly commented 6 years ago

Thanks for filing this issue. @mr1way

I doubt that there may be something abnormal with data structure definition.

I use harbor-go-client to analyse tags on harbor v1.5.0-d59c257e , it works fine.

I will upgrade my harbor version to v1.5.4 and do some tests.

I will ping you back tomorrow.

moooofly commented 6 years ago

Hi @mr1way, thanks for your patience.

Here is my test result.

env

image

[#933#root@ubuntu-1604 /go/src/github.com/moooofly/harbor-go-client]$./harborctl_linux_amd64 version

 __ __   ____  ____   ____    ___   ____          ____   ___            __  _      ____    ___  ____   ______
 |  |  | /    ||    \ |    \  /   \ |    \        /    | /   \          /  ]| |    |    |  /  _]|    \ |      |
 |  |  ||  o  ||  D  )|  o  )|     ||  D  )_____ |   __||     | _____  /  / | |     |  |  /  [_ |  _  ||      |
 |  _  ||     ||    / |     ||  O  ||    /|     ||  |  ||  O  ||     |/  /  | |___  |  | |    _]|  |  ||_|  |_|
 |  |  ||  _  ||    \ |  O  ||     ||    \|_____||  |_ ||     ||_____/   \_ |     | |  | |   [_ |  |  |  |  |
 |  |  ||  |  ||  .  \|     ||     ||  .  \      |     ||     |      \     ||     | |  | |     ||  |  |  |  |
 |__|__||__|__||__|\_||_____| \___/ |__|\_|      |___,_| \___/        \____||_____||____||_____||__|__|  |__|

+----------------------+------------------------------------------+
| Client Version       | 1.1.1                                    |
| Go Version           | go version go1.11.1 linux/amd64          |
| UTC Build Time       | 2018-11-01 09:04:10                      |
| Git Branch           | develop                                  |
| Git Tag              | v1.1.1-1-g95b64df                        |
| Git Hash             | 95b64dfbe2736df49c25853749559559c42615af |
+----------------------+------------------------------------------+
[#934#root@ubuntu-1604 /go/src/github.com/moooofly/harbor-go-client]$

TEST

after faking some projects, repositories and tags, the output of rp_tags as follow:

[#935#root@ubuntu-1604 /go/src/github.com/moooofly/harbor-go-client]$./harborctl_linux_amd64 rp_tags -d 0 -m 2000
===============================
==  Start tags RP Analysing  ==
===============================

--------------------
==> GET https://localhost/api/search?q=
==> on all Repos, max-days-untouched: 0   max-keep-num-after-Ndays: 2000
--------------------

------------------------------------------------------
| repo_name: temp_1/hello-world | tags_count: 1 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572576      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 1
--> max-keep-num-after-Ndays (2000) more than actual num (1), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_10/hello-world | tags_count: 2 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572577      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572577      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 2
--> max-keep-num-after-Ndays (2000) more than actual num (2), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_2/hello-world | tags_count: 6 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v3                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572578      |
| *      | v4                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572578      |
| *      | v6                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572578      |
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572578      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572578      |
| *      | v5                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572578      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 6
--> max-keep-num-after-Ndays (2000) more than actual num (6), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_3/hello-world | tags_count: 2 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572579      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572579      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 2
--> max-keep-num-after-Ndays (2000) more than actual num (2), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_4/hello-world | tags_count: 1 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572579      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 1
--> max-keep-num-after-Ndays (2000) more than actual num (1), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_5/hello-world | tags_count: 4 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v3                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572580      |
| *      | v4                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572580      |
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572580      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572580      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 4
--> max-keep-num-after-Ndays (2000) more than actual num (4), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_6/hello-world | tags_count: 4 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v3                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572581      |
| *      | v4                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572581      |
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572581      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572581      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 4
--> max-keep-num-after-Ndays (2000) more than actual num (4), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_7/hello-world | tags_count: 4 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v3                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572582      |
| *      | v4                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572582      |
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572582      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572582      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 4
--> max-keep-num-after-Ndays (2000) more than actual num (4), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_8/hello-world | tags_count: 5 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v3                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572583      |
| *      | v4                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572583      |
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572583      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572583      |
| *      | v5                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572583      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 5
--> max-keep-num-after-Ndays (2000) more than actual num (5), so DO NOTHING.

------------------------------------------------------
| repo_name: temp_9/hello-world | tags_count: 7 |
------------------------------------------------------
---
+--------+----------------------------------------------------+----------------------------------+-----------------+
| Action | TagName                                            | CreateTime                       | DaysPast        |
+--------+----------------------------------------------------+----------------------------------+-----------------+
| *      | v3                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572584      |
| *      | v4                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572584      |
| *      | v7                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572584      |
| *      | v6                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572584      |
| *      | v1                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572584      |
| *      | v2                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572584      |
| *      | v5                                                 | 2018-09-07T19:25:39.809797627Z   |  54.572584      |
+--------+----------------------------------------------------+----------------------------------+-----------------+
--> # of tags less than 0 days: 0 , # of tags more than 0 days: 7
--> max-keep-num-after-Ndays (2000) more than actual num (7), so DO NOTHING.

=== Finish tags RP Analysing ===

[#936#root@ubuntu-1604 /go/src/github.com/moooofly/harbor-go-client]$

FYI

image

image

image

CONCLUSION

Base on test result, I think the data structure definition that rp_tags need dose not change.

You can have a try with the latest version of harbor-go-client, and ping me back again.