Multiple Long lived branch Setup

I want setup multiple long lived branch for my python flask project but issue here is whenever I add the project on Sonarcloud for the first time it pick up for Automatically Analysis and according to the documentation (To enable branch analysis, your project must be set up for build-based analysis, not automatic analysis. Branch analysis is not available with automatic analysis.)

  • Afterwards manually change the analysis method from Automatic to build based CI Integrate.
  • Then in build.yml I add the below regex. But still it only showing master branch on Branch Tab inside project.

push:
branches:
- master
- master_*

  • Do you have branches named master_…?
  • Is the SonarCloud Analysis action running on those branches (check the logs of GitHub Actions runs on that branch). Keep in mind that your changes to build.yml will also have to be merged into those branches.

Hi Colin, Thanks for your response.

  • Yes I have branch which follow this regex (master_*).

  • And I again tried with removing my project from SonarCloud and then add it again and this time I also make sure that build.yml and sonar.properties file should be both on master and master_uat branch.

And the action you specified… ran? On the non-master branch? If not – that’s something to be sorted with GitHub Actions (making sure they’re triggered on your non-master branches).

If they did run, and you’re still without analysis of the other branch, what do the logs from the scanner say (the logs from the execution of the action)


It ran for master_test but in sonar cloud it is showing only master branch

If you click into the logs for a run on master_test, do you see that SonarCloud analysis run? If so, where does it link you at the end of the scanner logs?

INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=xxxxxxx&branch=master
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=xxxxxx
INFO: Analysis total time: 27.746 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------

Hi Colin,
It run successfully check the below log for master_test.

INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=**OrganizationName_RespositoryName**&pullRequest=4
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=xxxxxx
INFO: Analysis total time: 25.347 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS

And still getting the same issue only master branch is showing.

Hey there.

It looks like it’s being analyzed as a pull request.

How is your GitHub Actions YML file configured? Can you paste it here?

name: Build
on:
  push:
    branches:
      - master
      - master_*
  pull_request:
    types: [opened, synchronize, reopened]
jobs:
  sonarcloud:
    name: SonarCloud
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Hey there.

It looks like we have a fresh lead, take a look at the post here:

I’ve flagged this thread for some expert attention along with the others.

I’ve posted an update on this topic in this thread

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.