-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_force_publish
58 lines (55 loc) · 2.12 KB
/
Jenkinsfile_force_publish
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
pipeline {
environment {
ARTIFACTORY_URL = credentials('ARTIFACTORY_URL')
}
agent {
label 'build'
}
tools {
gradle "gradle-7.2"
jdk 'adoptjdk13'
}
stages {
stage ('Build and Test Libraries') {
steps {
withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
sh 'gradle clean test --info -b build.gradle'
}
}
}
stage ('Build Jars') {
steps {
withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
sh 'gradle jar --info -b build.gradle'
}
}
}
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-lib-project -Dsonar.host.url=https://sonarqube.cloud.cms.gov'
}
}
}
}
stage("Quality Gate") {
options {
timeout(time: 10, unit: 'MINUTES')
}
steps {
// Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails
// true = set pipeline to UNSTABLE, false = don't
waitForQualityGate abortPipeline: true
}
}
stage ('Publish Libraries') {
steps {
withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
sh 'gradle artifactoryPublish -b build.gradle'
}
}
}
}
}