#!/bin/bash
Username="admin"
Passwd="admin"
HaborUrl="http://172.16.38.202:8010"
RepoName=$1
Ttoken=`curl -iksL -X GET -u ${Username}:${Passwd} ${HaborUrl}/service/token?account=${Username}\&service=harbor-registry\&scope=repository:${RepoName}:pull --insecure|grep "token" |awk -F '"' '{print $4}'`
Llist=`curl -ksL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $Ttoken" ${HaborUrl}/v2/${RepoName}/tags/list|awk -F '[' '{print $2}'|awk -F ']' '{print $1}'|sed 's/"//g'`
echo $Llist|sed 's/,/\n/g' |sort