Replies: 1 comment 4 replies
-
PAGE=1
while : ; do
# Get page # of all registry projects
PROJECTS=$(curl -k -X 'GET' "{{ .Values.harbor.externalURL }}/api/v2.0/projects?page=${PAGE}&page_size=25&with_detail=true" -H 'authorization: Basic {{ printf "admin:%s" .Values.harbor.harborAdminPassword | b64enc }}' -H 'accept: application/json')
`((PAGE+=1))`
# Exit if no more projects
if [ $(echo $PROJECTS | jq length) -eq 0 ]; then
wait
break
fi
[CODE HERE]
done |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
stonezdj
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The version of harbor is v2.2.4-1bc848b3 and I want to get all the projects in the harbor.
Try to use the shell command below:
curl -u $Harbor_User:$Harbor_Passwd -H "Content-Type: application/json" -X GET http://${Harbor_Address}/api/v2.0/projects -k | python -m json.tool | grep name | awk '/"name": /' | awk -F '"' '{print $4}'
But only return few projects. How to get all the projects in harbor with shell?
Beta Was this translation helpful? Give feedback.
All reactions