Skip to content

Add shell plugin for SonarQube CLI#628

Open
eddumelendez wants to merge 3 commits into
1Password:mainfrom
eddumelendez:sonarqube-support
Open

Add shell plugin for SonarQube CLI#628
eddumelendez wants to merge 3 commits into
1Password:mainfrom
eddumelendez:sonarqube-support

Conversation

@eddumelendez

Copy link
Copy Markdown
Contributor

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:

  • SONARQUBE_CLI_TOKEN — user token (required, secret)
  • SONARQUBE_CLI_ORG — SonarQube Cloud organization key (optional)
  • SONARQUBE_CLI_SERVER — server URL for self-hosted instances or regional SonarQube Cloud endpoints (optional)

Type of change

  • Created a new plugin

Related Issue(s)

  • Resolves: #
  • Relates: #

How To Test

Run a scan using the SonarQube CLI with credentials stored in 1Password:

sonar scan \
  --project-key my-project \
  --source-dir .

With 1Password Shell Plugins configured, SONARQUBE_CLI_TOKEN and optionally SONARQUBE_CLI_ORG or `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.

Copilot AI review requested due to automatic review settings July 17, 2026 03:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sonarqube plugin with a sonar executable definition and NeedsAuth rules.
  • Adds a CLIToken credential type that maps item fields to SONARQUBE_CLI_TOKEN, SONARQUBE_CLI_ORG, and SONARQUBE_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/"),
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't apply IMO

Comment thread plugins/sonarqube/sonar_scanner.go Outdated
Comment on lines +10 to +13
func SonarScannerCLI() schema.Executable {
return schema.Executable{
Name: "SonarQube CLI",
Runs: []string{"sonar"},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partially fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants