Forked from mr-exz/sonar-set-project-as-private.sh
Last active
April 3, 2022 13:22
-
-
Save phaniamt/5fa9824c298556fea045b259a32c23ba to your computer and use it in GitHub Desktop.
How to set all existing projects to private in SonarQube
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # requirements: curl, jq | |
| # By default this script will get 100 projects at a time | |
| # If you have more than 100 projects . run this script multiple times | |
| USER=user | |
| PASSWORD=password | |
| SONAR_URL=http://localhost:9000 | |
| for pkey in `curl ${SONAR_URL}/api/components/search?qualifiers=TRK | jq -r .components[].key`; do | |
| curl -X POST -v -u ${USER}:${PASSWORD} ${SONAR_URL}/api/projects/update_visibility?project=${pkey}\&visibility=private; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment