Skip to content

Commit

Permalink
adding poolboy to sonarqube for static analysis of code (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
9strands authored Oct 18, 2024
1 parent 3d06031 commit c8c94c4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
stages:
- static-analysis

.static-analysis:
stage: static-analysis
interruptible: true
needs: []

sonarqube-check:
extends: .static-analysis
image: images.paas.redhat.com/alm/sonar-scanner-alpine:latest
variables:
LANG: "en_US.UTF-8"
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
SONAR_HOST_URL: https://sonarqube.corp.redhat.com
SONAR_SCM_PROVIDER: git
SONAR_SCANNER_OPTS: "-Xmx512m"
SONAR_USER_HOME: /tmp/.sonar
KUBERNETES_MEMORY_REQUEST: "512Mi"
KUBERNETES_MEMORY_LIMIT: "4Gi"
KUBERNETES_EPHEMERAL_STORAGE_REQUEST: "512Mi"
KUBERNETES_EPHEMERAL_STORAGE_LIMIT: "1Gi"
cache:
key: "${CI_JOB_NAME}"
paths:
- "${SONAR_USER_HOME}/cache"
script:
- >
set -x; sonar-scanner -Dsonar.python.version="3.7, 3.8, 3.9"
${SONAR_SETTINGS:+-Dproject.settings="$SONAR_SETTINGS"}
${SONAR_QUALITY_GATE_WAIT:+-Dsonar.qualitygate.wait="$SONAR_QUALITY_GATE_WAIT"}
${SONAR_SOURCE_ENCODING:+-Dsonar.sourceEncoding="$SONAR_SOURCE_ENCODING"}
${SONAR_PROJECT_KEY:+-Dsonar.projectKey="$SONAR_PROJECT_KEY"}
${SONAR_PROJECT_NAME:+-Dsonar.projectName="$SONAR_PROJECT_NAME"}
${SONAR_PROJECT_VERSION:+-Dsonar.projectVersion="$SONAR_PROJECT_VERSION"}
${SONAR_SOURCES:+-Dsonar.sources="$SONAR_SOURCES"}
${SONAR_EXCLUSIONS:+-Dsonar.exclusions="$SONAR_EXCLUSIONS"}
${SONAR_SCM_PROVIDER:+-Dsonar.scm.provider="$SONAR_SCM_PROVIDER"}
${CI_MERGE_REQUEST_IID:+-Dsonar.pullrequest.key="$CI_MERGE_REQUEST_IID"}
${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:+-Dsonar.pullrequest.branch="$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"}
${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:+-Dsonar.pullrequest.base="$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"}
timeout: 15 minutes
allow_failure: true
tags:
- shared
2 changes: 2 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sonar.projectKey=com.redhat.rhpds.redhat-cop.poolboy
sonar.qualitygate.wait=true

0 comments on commit c8c94c4

Please sign in to comment.