Skip to content

How to get all the projects in harbor #17426

Answered by dioguerra
finalha asked this question in Q&A
Discussion options

You must be logged in to vote
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

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@finalha
Comment options

@dioguerra
Comment options

@IMpcuong
Comment options

@dioguerra
Comment options

Answer selected by stonezdj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants