Add shell plugin for SonarQube CLI#628
Open
eddumelendez wants to merge 3 commits into
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new sonarqube shell plugin so 1Password Shell Plugins can provision SonarQube CLI credentials via environment variables for the sonar executable.
Changes:
- Introduces a new
sonarqubeplugin with asonarexecutable definition andNeedsAuthrules. - Adds a
CLITokencredential type that maps item fields toSONARQUBE_CLI_TOKEN,SONARQUBE_CLI_ORG, andSONARQUBE_CLI_SERVER. - Adds importer/provisioner tests to validate env-var mapping behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugins/sonarqube/sonar_scanner.go | Defines the sonar executable and its authentication gating rules. |
| plugins/sonarqube/plugin.go | Declares the new sonarqube plugin and wires credentials + executable together. |
| plugins/sonarqube/cli_token.go | Implements the credential schema and env-var provisioning/importing. |
| plugins/sonarqube/cli_token_test.go | Adds tests covering importer/provisioner behavior for the credential. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+11
to
+14
| Platform: schema.PlatformInfo{ | ||
| Name: "SonarQube CLI", | ||
| Homepage: sdk.URL("https://docs.sonarsource.com/sonarqube-cli/"), | ||
| }, |
Contributor
Author
There was a problem hiding this comment.
doesn't apply IMO
Comment on lines
+10
to
+13
| func SonarScannerCLI() schema.Executable { | ||
| return schema.Executable{ | ||
| Name: "SonarQube CLI", | ||
| Runs: []string{"sonar"}, |
Contributor
Author
There was a problem hiding this comment.
partially fixed
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.
Overview
Adds a shell plugin for SonarQube CLI (sonar), enabling 1Password to automatically inject authentication credentials via environment variables.
The plugin supports the three environment variables from the SonarQube CLI docs:
Type of change
Related Issue(s)
How To Test
Run a scan using the SonarQube CLI with credentials stored in 1Password:
With 1Password Shell Plugins configured,
SONARQUBE_CLI_TOKENand optionallySONARQUBE_CLI_ORGor `SONARQUBE_CLI_SERVER will be injected automatically from the stored item.Changelog
Added a shell plugin for the SonarQube CLI that enables authenticating sonar using credentials stored in 1Password.