-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.testing
67 lines (58 loc) · 2 KB
/
Jenkinsfile.testing
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
66
67
pipeline {
environment {
ARTIFACTORY_URL = credentials('ARTIFACTORY_URL')
}
agent {
label 'build'
}
tools {
gradle "gradle-7.5"
jdk 'openjdk17'
}
stages {
stage ('Build files') {
steps {
withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
sh 'gradle build -x test'
}
}
}
stage ('Do tests') {
steps {
withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
sh 'gradle clean test --info build'
}
}
}
stage ('Build Jar') {
steps {
withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
sh 'gradle jar --info build'
}
}
}
stage('SonarQube Analysis') {
steps {
withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
// Automatically saves the an id for the SonarQube build
withSonarQubeEnv('CMSSonar') {
sh 'gradle sonarqube -Dsonar.projectKey=ab2d-events -Dsonar.host.url=https://sonarqube.cloud.cms.gov'
}
}
}
}
stage("Quality Gate") {
steps {
sleep(10)
timeout(time: 10, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
}
}
}
stage("SBOM") {
steps {
sh 'gradle cyclonedxBom'
}
}
}
}