怎样从harbor中取出最新的tag标签

有些时候需要知道harbor中最新的tag是多少,方便k8s 部署的时候加载: 下面是从harbor中取出5个最新的tag值,按push时间排序: curl -s  -u xxx:yyy -X GET "https://hub.jundax.com/api/v2...

有些时候需要知道harbor中最新的tag(arti是多少,方便k8s 部署的时候加载:

下面是从harbor中取出5个最新的tag值,按push时间排序:


curl -s  -u xxx:yyy -X GET "https://hub.jundax.com/api/v2.0/projects/houchu/repositories/omt-as/artifacts?page=1&page_size=5&with_tag=true&with_label=false&with_scan_overview=false&with_signature=false&with_immutable_status=false" -H "accept: application/json"|sed 's/,/\n/g'|awk -F ':' '/name/{gsub(/"/,"",$2);print $2}'


其中 -u 后面 xxx为harbor登录用户名,yyy为harbor登录密码,命令打印出最新的5个标签


通过habor 2.0 api删除artifacts(构件) 

for i in `latest_image.sh omt-as 1000|tail -n 650`;do curl -s  -u user:password-X DELETE "https://hub.jundax.com/api/v2.0/projects/houchu/repositories/omt-as/artifacts/$i"  -H "accept: application/json"; done



harbor打印出项目名称

curl -s -u user:password   -H "Content-Type: application/json" -X GET  https://hub.jundax.com/api/v2.0/projects? -k|grep -Po '(?<="name":).*'|awk '{gsub(/[",]/,"",$0);print}'

  • 发表于 2021-03-11 19:53
  • 阅读 ( 43 )

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
shitian
shitian

662 篇文章

作家榜 »

  1. shitian 662 文章
  2. 石天 437 文章
  3. 每天惠23 33 文章
  4. 小A 29 文章