[KATTU-334]Update sonar workflow in develop. - #345
Conversation
Removed unnecessary inputs and environmental variables for Android location and organization. Updated Sonar analysis command to use secrets and simplified the workflow. Signed-off-by: Mahesh-Binayak <76687012+Mahesh-Binayak@users.noreply.github.com>
WalkthroughThe reusable ChangesGradle Sonar Analysis Workflow Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/gradlew-sonar-analysis.yml:
- Around line 18-21: The workflow file now declares ORG_KEY as the required
secret (line 21), but the documentation in docs/gradlew-sonar-analysis-readme.md
still references the old SONAR_ORGANIZATION secret name at lines 23-24. Update
the documentation file to replace all occurrences of SONAR_ORGANIZATION with
ORG_KEY to ensure consistency between the workflow contract and the setup
instructions provided to users.
- Around line 73-81: The `run` script in the gradlew-sonar-analysis workflow
directly expands user inputs like `inputs.SERVICE_LOCATION` and
`inputs.SONAR_ARGS` without proper quoting or escaping, creating a security
vulnerability. Move the inputs into environment variables first using the `env`
section at the beginning of the `run` block, then reference them with proper
double quotes throughout the script (e.g., `"$SERVICE_LOCATION"` and
`$SONAR_ARGS`) to prevent shell injection and command expansion attacks.
- Around line 57-63: The validation block checks for SONAR_TOKEN and ORG_KEY but
does not validate SONAR_URL, which is used later in the same step. Add a
conditional check for the SONAR_URL input (using inputs.SONAR_URL) in the
validation block alongside the existing SONAR_TOKEN and ORG_KEY checks,
following the same pattern with an if statement that echoes an error message and
exits with code 1 if the value is empty.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2ad0d7a2-fb10-42b1-ad90-a487aac3e330
📒 Files selected for processing (1)
.github/workflows/gradlew-sonar-analysis.yml
Removed unnecessary inputs and environmental variables for Android location and organization. Updated Sonar analysis command to use secrets and simplified the workflow.
Summary by CodeRabbit