I don’t want to manually go into the bitbucket UI for ALL my repos every time I need to add a new sonar project and click a button to hook them up to their sonar project.
This is not officially supported, but thats a pain point everyone is using this workaround for:
- How do I script linking a SonarCloud project to a Bitbucket Cloud repo - #11 by jonathanmedd
- API to enable AutoScan for GitHub repo - #8 by red_888
I see no examples of how to do this for bitbucket only github. When I try making a POST to “https://sonarcloud.io/api/alm_integration/provision_projects” with my bitbucket info I get a 404.
This is the request for github:
curl --include \
--request POST \
--header "Content-Type: application/x-www-form-urlencoded" \
-u ${SONAR_TOKEN}: \
--data-binary "installationKeys=${GITHUB_ORG}%2F${REPO_NAME}%7C${REPO_ID}&organization=${SONAR_ORG}" \
"https://sonarcloud.io/api/alm_integration/provision_projects"
What is the right request for bitbucket cloud?
I tried this but it returns a 404:
"installationKeys=${bitbucketOrg}_${repoName}&organization=${bitbucketOrg}"