forked from USDAForestService/fs-open-forest-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fsopenforestplatform.jenkinsfile
65 lines (47 loc) · 2.73 KB
/
fsopenforestplatform.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pipeline {
agent {
node {
label 'linuxworker1'
}
}
options {
timestamps()
disableConcurrentBuilds()
ansiColor('xterm')
buildDiscarder(logRotator(numToKeepStr: '3'))
}
stages {
stage('Checkout from SCM'){
steps {
script {
currentBuild.displayName = "#$BUILD_NUMBER fs-open-forest-platform Deploy"
currentBuild.description = "fs-open-forest-platform Deployment"
}
checkout([$class: 'GitSCM', branches: [[name: '*/dev']], doGenerateSubmoduleConfigurations: false, extensions: [], gitTool: 'GIT', submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'a2771711-7381-4f18-8d28-1d1dfec426c3', url: 'https://github.com/USDAForestService/fs-open-forest-platform.git']]])
}
}
stage('Security Scanning'){
steps {
script {
def scannerhome = tool 'SonarQubeScanner';
withSonarQubeEnv('SonarQube') {
sh label: '', script: '''/home/Jenkins/.dotnet/tools/dotnet-sonarscanner begin /k:"fs-open-forest-platform" /d:sonar.login=686109daf6b0ac668b501a65556918f2803a3aa0 /d:sonar.sources=. /v:1.0'''
sh 'sleep 180'
sh 'rm -rf sonarqubereports'
sh 'mkdir sonarqubereports'
sh 'java -jar /home/Jenkins/sonar-cnes-report-3.1.0.jar -t 309e68d4284f8cc7b120289544d87ebcc76f09ae -s http://10.0.0.117:9090 -p fs-open-forest-platform -o sonarqubereports'
sh 'cp sonarqubereports/*analysis-report.docx sonarqubereports/sonarqubeanalysisreport.docx'
sh 'cp sonarqubereports/*issues-report.xlsx sonarqubereports/sonarqubeissuesreport.xlsx'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '', reportFiles: 'sonarqubereports/sonarqubeanalysisreport.docx', reportName: 'SonarQube Analysis Report (Word)', reportTitles: 'SonarQube Analysis Report'])
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '', reportFiles: 'sonarqubereports/sonarqubeissuesreport.xlsx', reportName: 'SonarQube Issues Report (Excel)', reportTitles: 'SonarQube Issues Report'])
}
}
}
}
stage('Notification'){
steps {
emailext attachLog: true, attachmentsPattern: 'sonarqubereports/sonarqubeanalysisreport.docx,sonarqubereports/sonarqubeissuesreport.xlsx,pa11y/index.html', body: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.', replyTo: '[email protected]', subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', to: '[email protected]'
}
}
}
}