Skip to content

Commit 11868de

Browse files
authored
add Jenkins pipeline & Sonarqube scanner
1 parent d97172d commit 11868de

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

Jenkinsfile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
library "aplazame-shared-library"
2+
3+
pipeline {
4+
agent {
5+
kubernetes {
6+
yamlFile "/jenkins/php.yaml"
7+
}
8+
}
9+
environment {
10+
FOLDER = "dist"
11+
foldersCache = '"vendor/"'
12+
}
13+
options {
14+
disableConcurrentBuilds()
15+
ansiColor('xterm')
16+
}
17+
stages {
18+
stage('Test Sonarqube') {
19+
when {
20+
not {
21+
tag "*"
22+
}
23+
beforeAgent true
24+
}
25+
agent {
26+
kubernetes {
27+
yamlFile "/jenkins/jenkins-sonar.yaml"
28+
}
29+
}
30+
environment {
31+
SONAR_TEST = credentials('SONAR_TEST')
32+
CODE_SOURCE_DEFAULT = "*"
33+
}
34+
steps {
35+
scmSkip()
36+
container('sonar') {
37+
sonarScan(SONAR_TEST,CODE_SOURCE_DEFAULT)
38+
}
39+
}
40+
}
41+
}
42+
}

jenkins/jenkins-sonar.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
apiVersion: v1
3+
kind: Pod
4+
metadata:
5+
name: apptest
6+
spec:
7+
serviceAccountName: aplazame-appdeployer
8+
serviceAccount: aplazame-appdeployer
9+
securityContext:
10+
fsGroup: 1000
11+
containers:
12+
- name: sonar
13+
image: 666356151544.dkr.ecr.eu-central-1.amazonaws.com/tools/sonar-scanner:4.6.2.2472_2
14+
imagePullPolicy: Always
15+
tty: true
16+
resources:
17+
limits:
18+
cpu: 1
19+
memory: 3Gi
20+
restartPolicy: Never

jenkins/php.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
spec:
5+
serviceAccountName: aplazame-appdeployer
6+
serviceAccount: aplazame-appdeployer
7+
securityContext:
8+
fsGroup: 1000
9+
containers:
10+
- name: php
11+
image: 666356151544.dkr.ecr.eu-central-1.amazonaws.com/thirdparty/php:7.3.9_v5
12+
imagePullPolicy: Always
13+
command:
14+
- cat
15+
tty: true
16+
resources:
17+
requests:
18+
#memory: 200Mi
19+
memory: 2Gi
20+
cpu: 200m
21+
limits:
22+
#memory: 450Mi
23+
memory: 4Gi
24+
cpu: 500m

sonar-scanner.properties

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sonar.projectKey=php-sdk
2+
sonar.projectName=php-sdk
3+
sonar.projectVersion=1.0
4+
sonar.projectBaseDir=/usr/src
5+
sonar.python.coverage.reportPaths=/src/coverage.xml
6+
sonar.host.url=https://sonarqube.aplazame.org/
7+
sonar.password=
8+
sonar.ws.timeout=600
9+
sonar.log.level=DEBUG
10+
ActiveQualityGate=false

0 commit comments

Comments
 (0)