Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
sonar-scanner-cli sonar-scanner-cli
Invokes scan using Sonarqube, step is not compatible with C/C++/Objective-C projects. Requires sonar-project.properties file with Project Name and Key defined. Documentation - https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
arguments
SimpleScan:
type: sonar-scanner-cli
arguments:
SONAR_HOST_URL: 'http://foo.acme:9000'
SONAR_LOGIN: username or key
SONAR_PASSWORD: password if username is used
SONAR_PROJECT_BASE_DIR: set working directory for analysis
SONAR_SCANNER_CLI_VERSION: latest
PullRequestScan:
type: sonar-scanner-cli
arguments:
SONAR_HOST_URL: 'https://sonarcloud.io'
SONAR_ANALYSIS_PARAMETERS:
- 'sonar.pullrequest.key=${{CF_PULL_REQUEST_NUMBER}}'
- 'sonar.pullrequest.branch=${{CF_BRANCH}}'
- 'sonar.pullrequest.base=${{CF_PULL_REQUEST_TARGET}}'
- 'sonar.organization=${{CF_REPO_OWNER}}'
- 'sonar.projectKey=${{CF_REPO_OWNER}}_${{CF_REPO_NAME}}'
- >-
sonar.projectBaseDir=/codefresh/volume/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}
- 'sonar.login=${{SONAR_LOGIN}}'