1. clicklogiq/sonarqube@1.0.1

clicklogiq/sonarqube@1.0.1

Sections
Created: November 28, 2019Version Published: December 23, 2020Releases: 4
Org Usage:
< 25

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: sonarqube: clicklogiq/sonarqube@1.0.1

Use sonarqube elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Jobs

analyze

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
organization
-
No
SONARQUBE_SERVER_ORGANIZATION
env_var_name
host_url
-
No
SONARQUBE_SERVER_URL
env_var_name
login
-
No
SONARQUBE_SERVER_LOGIN
env_var_name
projectKey
-
No
CIRCLE_PROJECT_REPONAME
env_var_name
projectVersion
-
No
CIRCLE_BUILD_NUM
env_var_name
github_oauth
-
No
SONARQUBE_GITHUB_OAUTH
env_var_name
github_repository
-
No
SONARQUBE_SERVER_ORGANIZATION
env_var_name
github_pullRequest
-
No
CIRCLECI_PULL_REQUEST_NUMBER
env_var_name

Commands

setup-environment

Setup requirements

Show command Source

install-engine

Install Sonarqube scanner

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
engine_version
-
No
4.2.0.1873
string

code-analysis

Run Sonarqube scanner for code analysis

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
organization
-
Yes
-
string
host_url
-
Yes
-
string
login
-
Yes
-
string
projectKey
-
Yes
-
string
projectBaseDir
-
No
/root/circleci-build
string
sources
-
No
.
string
github_oauth
-
Yes
-
string
github_repository
-
Yes
-
string
runner_opts
-
No
'-Xms1024m -Xmx4096m'
string
exclusions
-
No
'**/*.yaml,**/*.yml'
string
engine_version
-
No
4.2.0.1873
string

commit-analysis

Run Sonarqube scanner for commit analysis

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
organization
-
Yes
-
string
host_url
-
Yes
-
string
login
-
Yes
-
string
projectKey
-
Yes
-
string
projectVersion
-
Yes
-
string
projectBaseDir
-
No
/root/circleci-build
string
sources
-
No
.
string
github_oauth
-
Yes
-
string
github_pullRequest
-
Yes
-
string
github_repository
-
Yes
-
string
github_disableInlineComments
-
No
false
boolean
analysis_mode
-
No
preview
string
issuesReport_console_enable
-
No
true
boolean
runner_opts
-
No
'-Xms1024m -Xmx4096m'
string
exclusions
-
No
'**/*.yaml,**/*.yml'
string
engine_version
-
No
4.2.0.1873
string

Executors

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 executors: scanner: docker: - image: alpine:latest commands: setup-environment: description: "Setup requirements" steps: - run: name: "Setup environment" command: | apk update apk add --no-cache zip openjdk11-jre-headless install-engine: description: "Install Sonarqube scanner" parameters: engine_version: type: string default: "4.2.0.1873" steps: - run: name: "Install Sonarqube scanner" command: | wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-<< parameters.engine_version >>.zip unzip sonar-scanner-cli-<< parameters.engine_version >>.zip code-analysis: description: "Run Sonarqube scanner for code analysis" parameters: organization: type: string host_url: type: string login: type: string projectKey: type: string projectBaseDir: type: string default: "/root/circleci-build" sources: type: string default: "." github_oauth: type: string github_repository: type: string runner_opts: type: string default: "-Xms1024m -Xmx4096m" exclusions: type: string default: "**/*.yaml,**/*.yml" engine_version: type: string default: "4.2.0.1873" steps: - run: name: "Code analysis" command: | export SONAR_RUNNER_OPTS="<< parameters.runner_opts >>" eval ./sonar-scanner-<< parameters.engine_version >>/bin/sonar-scanner \ -Dsonar.organization=${<< parameters.organization >>} \ -Dsonar.host.url=${<< parameters.host_url >>} \ -Dsonar.login=${<< parameters.login >>} \ -Dsonar.projectKey=${<< parameters.projectKey >>} \ -Dsonar.projectBaseDir=<< parameters.projectBaseDir >> \ -Dsonar.sources=<< parameters.sources >> \ -Dsonar.github.oauth=${<< parameters.github_oauth >>} \ -Dsonar.github.repository=${<< parameters.github_repository >>} \ -Dsonar.exclusions="<< parameters.exclusions >>" commit-analysis: description: "Run Sonarqube scanner for commit analysis" parameters: organization: type: string host_url: type: string login: type: string projectKey: type: string projectVersion: type: string projectBaseDir: type: string default: "/root/circleci-build" sources: type: string default: "." github_oauth: type: string github_pullRequest: type: string github_repository: type: string github_disableInlineComments: type: boolean default: false analysis_mode: type: string default: "preview" issuesReport_console_enable: type: boolean default: true runner_opts: type: string default: "-Xms1024m -Xmx4096m" exclusions: type: string default: "**/*.yaml,**/*.yml" engine_version: type: string default: "4.2.0.1873" steps: - run: name: "Commit analysis" command: | echo "${<< parameters.github_pullRequest >>}" if [ ! -z "${<< parameters.github_pullRequest >>}" ]; then export SONAR_RUNNER_OPTS="<< parameters.runner_opts >>" eval ./sonar-scanner-<< parameters.engine_version >>/bin/sonar-scanner \ -Dsonar.organization=${<< parameters.organization >>} \ -Dsonar.host.url=${<< parameters.host_url >>} \ -Dsonar.login=${<< parameters.login >>} \ -Dsonar.projectKey=${<< parameters.projectKey >>} \ -Dsonar.projectVersion=2.${<< parameters.projectVersion >>} \ -Dsonar.issuesReport.console.enable=<< parameters.issuesReport_console_enable >> \ -Dsonar.projectBaseDir=<< parameters.projectBaseDir >> \ -Dsonar.sources=<< parameters.sources >> \ -Dsonar.analysis.mode=<< parameters.analysis_mode >> \ -Dsonar.github.pullRequest=${<< parameters.github_pullRequest >>} \ -Dsonar.github.disableInlineComments=<< parameters.github_disableInlineComments >> \ -Dsonar.github.oauth=${<< parameters.github_oauth >>} \ -Dsonar.github.repository=${<< parameters.github_repository >>} \ -Dsonar.exclusions="=<< parameters.exclusions >>" else echo "Check skipped..." fi jobs: analyze: parameters: organization: type: env_var_name default: SONARQUBE_SERVER_ORGANIZATION host_url: type: env_var_name default: SONARQUBE_SERVER_URL login: type: env_var_name default: SONARQUBE_SERVER_LOGIN projectKey: type: env_var_name default: CIRCLE_PROJECT_REPONAME projectVersion: type: env_var_name default: CIRCLE_BUILD_NUM github_oauth: type: env_var_name default: SONARQUBE_GITHUB_OAUTH github_repository: type: env_var_name default: SONARQUBE_SERVER_ORGANIZATION github_pullRequest: type: env_var_name default: CIRCLECI_PULL_REQUEST_NUMBER executor: scanner steps: - checkout - setup-environment - install-engine - commit-analysis: login: << parameters.login >> host_url: <<parameters.host_url >> organization: << parameters.organization >> projectKey: << parameters.projectKey >> projectVersion: << parameters.projectVersion >> github_oauth: << parameters.github_oauth >> github_repository: << parameters.github_repository >> github_pullRequest: << parameters.github_pullRequest >> projectBaseDir: ./ - code-analysis: login: << parameters.login >> host_url: <<parameters.host_url >> organization: << parameters.organization >> projectKey: << parameters.projectKey >> github_oauth: << parameters.github_oauth >> github_repository: << parameters.github_repository >> projectBaseDir: ./
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.