Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
[skip ci] Add rendered and modified Helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
stakater-user committed Jan 27, 2024
1 parent 83449f9 commit 1b1c59d
Showing 1 changed file with 94 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
# Source: stakater-sonarqube-scan/templates/clustertask.yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: stakater-sonarqube-scan-0.0.13
spec:
description: >-
The following task can be used to perform static analysis on the source code
provided the SonarQube server is hosted
SonarQube is the leading tool for continuously inspecting the Code Quality and Security
of your codebases, all while empowering development teams. Analyze over 25 popular
programming languages including C#, VB.Net, JavaScript, TypeScript and C++. It detects
bugs, vulnerabilities and code smells across project branches and pull requests.
workspaces:
- name: source
params:
- name: SONAR_HOST_URL
description: Host URL where the sonarqube server is running
default: ""
- name: SONAR_PROJECT_KEY
description: Project's unique key
default: ""
- name: SONAR_LOGIN
description: Sonar username
default: ""
- name: SONAR_PASSWORD
description: Sonar password
default: ""
- name: SONAR_CREDS_SECRET_NAME
description: Sonar credentials secret name
default: "sonar-creds"
steps:
- name: sonar-properties
image: registry.access.redhat.com/ubi8/ubi-minimal:8.9-1108.1705420507
workingDir: $(workspaces.source.path)
env:
- name: SONAR_LOGIN
valueFrom:
secretKeyRef:
name: $(params.SONAR_CREDS_SECRET_NAME)
key: username
- name: SONAR_PASSWORD
valueFrom:
secretKeyRef:
name: $(params.SONAR_CREDS_SECRET_NAME)
key: password
script: |
#!/usr/bin/env bash
replaceValues() {
filename=$1
thekey=$2
newvalue=$3
if ! grep -R "^[#]*\s*${thekey}=.*" $filename >/dev/null; then
echo "APPENDING because '${thekey}' not found"
echo "" >>$filename
echo "$thekey=$newvalue" >>$filename
else
echo "SETTING because '${thekey}' found already"
sed -ir "s|^[#]*\s*${thekey}=.*|$thekey=$newvalue|" $filename
fi
}
if [[ -f $(workspaces.source.path)/sonar-project.properties ]]; then
if [[ -n "$(params.SONAR_HOST_URL)" ]]; then
replaceValues $(workspaces.source.path)/sonar-project.properties sonar.host.url $(params.SONAR_HOST_URL)
fi
if [[ -n "$(params.SONAR_PROJECT_KEY)" ]]; then
replaceValues $(workspaces.source.path)/sonar-project.properties sonar.projectKey $(params.SONAR_PROJECT_KEY)
fi
replaceValues $(workspaces.source.path)/sonar-project.properties sonar.login $SONAR_LOGIN
replaceValues $(workspaces.source.path)/sonar-project.properties sonar.password $SONAR_PASSWORD
else
echo "No sonar-project.properties found"
exit 128
fi
- name: sonar-scan
image: stakater/pipeline-toolbox:v0.0.36
workingDir: $(workspaces.source.path)
command:
- /bin/bash
args:
- -c
- |
if [ -f "pom.xml" ]
then
mvn -f pom.xml clean package
fi
sonar-scanner

0 comments on commit 1b1c59d

Please sign in to comment.