This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
45 lines (45 loc) · 1.51 KB
/
Jenkinsfile
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
// Uses Declarative syntax to run commands inside a container.
pipeline {
triggers {
pollSCM("*/5 * * * *")
}
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: golang
image: golang:latest
command:
- sleep
args:
- infinity
'''
// Can also wrap individual steps:
// container('shell') {
// sh 'hostname'
// }
defaultContainer 'golang'
}
}
stages {
stage('Lint code') {
steps {
sh "mkdir -p /usr/share/man/man1"
sh "apt-get update"
sh "apt-get install -y apt-utils"
sh "apt-get install -y openjdk-11-jre-headless libzip-dev git wget unzip"
sh 'java -version'
sh 'go build go.jinya.de/ontheroad'
sh 'wget -U "scannercli" -q -O /opt/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.5.0.2216.zip'
sh "cd /opt && unzip sonar-scanner-cli.zip"
sh "export SONAR_HOME=/opt/sonar-scanner-4.5.0.2216"
sh 'export PATH="$PATH:/opt/sonar-scanner-4.5.0.2216/bin"'
sh "sed -i 's@#sonar\\.host\\.url=http:\\/\\/localhost:[email protected]=https://sonarqube.imanuel.dev@g' /opt/sonar-scanner-4.5.0.2216/conf/sonar-scanner.properties"
sh "/opt/sonar-scanner-4.5.0.2216/bin/sonar-scanner"
}
}
}
}