Repository navigation
docs: do the SonarCloud main-branch setup before the first merge to main - #170
Merged
Merged
Conversation
CI creates a missing Sonar project itself with the main branch master, so the rename must happen before the first push or merge to main. State the organization (cuioss-github) and add a verification command, in the README and in the customize.sh next steps. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AEE74wh8Lty7n7shHcsVCX
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Excluded labels (none allowed): 1
Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="customize.sh" line_range="121" />
<code_context>
echo "Next steps (see README.adoc, 'After creating the repository'):"
echo " - Do NOT change release.current-version in .github/project.yml: merging that change IS a release."
-echo " - SonarCloud: create ${PROJECT_SONAR_ID} and rename its main branch 'master' to 'main' before the first analysis."
+echo " - SonarCloud, BEFORE the first push or merge to main (CI would create the project itself with main branch 'master'):"
+echo " create ${PROJECT_SONAR_ID} in organization cuioss-github and rename its main branch 'master' to 'main'."
+echo " Verify: curl -s \"https://sonarcloud.io/api/project_branches/list?project=${PROJECT_SONAR_ID}\" (isMain must be 'main')"
</code_context>
<issue_to_address>
**SonarCloud project gets wrong main branch**
When a pull request targeting `main` is the first event to run CI, the Maven workflow runs Sonar analysis before the prescribed setup, so SonarCloud creates the project with `master` as its main branch. The project overview then uses the wrong branch.
Require creating the SonarCloud project and renaming its main branch to `main` before any analysis, including pull-request analysis.
Also at `customize.sh:122`.
</issue_to_address>
### Comment 2
<location path="customize.sh" line_range="123" />
<code_context>
-echo " - SonarCloud: create ${PROJECT_SONAR_ID} and rename its main branch 'master' to 'main' before the first analysis."
+echo " - SonarCloud, BEFORE the first push or merge to main (CI would create the project itself with main branch 'master'):"
+echo " create ${PROJECT_SONAR_ID} in organization cuioss-github and rename its main branch 'master' to 'main'."
+echo " Verify: curl -s \"https://sonarcloud.io/api/project_branches/list?project=${PROJECT_SONAR_ID}\" (isMain must be 'main')"
echo " - Add ${PROJECT_KEY} to 'consumers:' in cuioss-organization/.github/project.yml."
echo " - Apply branch protection / merge queue with cuioss-organization/branch-protection."
</code_context>
<issue_to_address>
**SonarCloud verification gives an impossible check**
When users follow the printed verification instructions, the SonarCloud API returns `isMain` as a boolean and reports the branch name separately, so checking whether `isMain` is `'main'` cannot verify the configuration. Users can reject a correctly configured `main` branch or fail to notice that it is not the main branch.
Tell users to verify that the branch named `main` has `isMain: true`.
Also at `customize.sh:124`.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: customize.sh:121, customize.sh:123
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AEE74wh8Lty7n7shHcsVCX
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Following the README, derived repositories ended up with a Sonar main branch called
master: the step said "before the first analysis", but CI auto-creates a missing project withmasteras soon as the first merge tomainruns. Seen in cuioss/TrailHand and cuioss/git-document-repository (fixed there by deleting the short-livedmainand renamingmaster). A project was also created in the wrong organization.Change
main, names the organizationcuioss-github, and ends with a verification (project_branches/list,isMainmust bemain).customize.sh: the printed next steps say the same.No change to
.github/project.ymlor the release workflow, so nothing reaches the release guard.🤖 Generated with Claude Code
https://claude.ai/code/session_01AEE74wh8Lty7n7shHcsVCX