Repository navigation
[None][infra] Add SonarQube code analysis in github action #10677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | |||||||||||||||||||||||||||||
| name: SonarQube | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - main | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| types: [opened, synchronize, reopened] | |||||||||||||||||||||||||||||
| workflow_dispatch: | |||||||||||||||||||||||||||||
| inputs: | |||||||||||||||||||||||||||||
| ref: | |||||||||||||||||||||||||||||
| description: 'commit sha to check' | |||||||||||||||||||||||||||||
| required: true | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| build: | |||||||||||||||||||||||||||||
| name: Build and analyze | |||||||||||||||||||||||||||||
| runs-on: blossom | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |||||||||||||||||||||||||||||
| ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref }} | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - uses: SonarSource/sonarqube-scan-action@v4 | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |||||||||||||||||||||||||||||
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |||||||||||||||||||||||||||||
| # If you wish to fail your job when the Quality Gate is red, uncomment the | |||||||||||||||||||||||||||||
| # following lines. This would typically be used to fail a deployment. | |||||||||||||||||||||||||||||
| # We do not recommend to use this in a pull request. Prefer using pull request | |||||||||||||||||||||||||||||
| # decoration instead. | |||||||||||||||||||||||||||||
| # - uses: SonarSource/sonarqube-quality-gate-action@v1 | |||||||||||||||||||||||||||||
| # timeout-minutes: 5 | |||||||||||||||||||||||||||||
| # env: | |||||||||||||||||||||||||||||
| # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+36
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 10 months ago In general, the fix is to explicitly declare a Concretely, in
Suggested changeset
1
.github/workflows/sonarqube-code-analysis.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| sonar.projectKey=GPUSW_TensorRT-LLM-Team_TensorRT-LLM_tensorrt-llm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably won't be able to use the blossom runner for these actions, since they have some special configuration designed to work only with the blossom workflow. I think the standard
ubuntu-latestrunner should work for this, unless the SonarQube server requires special network access.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this needs to hit internal sonarqube API like: https://sonar.nvidia.com/api/server/version
I closed this PR for now and play with it in my fork, now I set up a new runner with my dev-box in my fork to get it running