forked from IRS-GitOps/Spring-Boot-WebSocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
72 lines (72 loc) · 2.48 KB
/
Jenkinsfile
File metadata and controls
72 lines (72 loc) · 2.48 KB
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
68
69
70
71
72
pipeline {
agent {
kubernetes {
yamlFile 'maven-pod.yml'
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '2'))
skipDefaultCheckout true
preserveStashes(buildCount: 2)
}
stages('First 6 Stages of CI/CD')
{
stage('Pull Source Code from SCM') {
steps {
container ('maven') {
checkout scm
}
}
}
stage('Maven Build Compile/Unit Test') {
steps {
container ('maven') {
sh 'mvn install'
sh 'mvn compile'
}
}
}
stage('Code Coverage - Sonar Scans') {
steps {
container('maven') {
withCredentials([string(credentialsId: 'Sonar_Login', variable: 'Sonar_Login'), string(credentialsId: 'Sonar_URL', variable: 'Sonar_URL'), string(credentialsId: 'Sonar_Project', variable: 'Sonar_Project')]) {
sh 'mvn sonar:sonar -Dsonar.projectKey=${Sonar_Project} -Dsonar.host.url=${Sonar_URL} -Dsonar.login=${Sonar_Login}'
}
}
}
}
stage('Quality Scans') {
steps {
container('maven') {
echo 'Quality Scanning Success!'
}
}
}
stage('Security Scans') {
steps {
container('maven') {
echo 'Security Scanning Success!'
}
}
}
stage('Deploy to Nexus') {
when {
branch 'master'
}
steps {
container('maven') {
input(message: "Deploy this artifact as a release candidate?", ok: "Approve", submitterParameter: "APPROVER")
nexusArtifactUploader artifacts: [[artifactId: 'spring-boot-starter-parent', classifier: '', file: 'target/spring-boot-websocket-0.0.1-SNAPSHOT.jar', type: 'jar']], credentialsId: 'ci-sa', groupId: 'org.springframework.boot', nexusUrl: 'nexus.cb-demos.io', nexusVersion: 'nexus3', protocol: 'https', repository: 'maven-releases', version: '0.0.1'
}
}
}
stage('Trigger Release Candidate') {
when {
branch 'master'
}
steps {
cloudBeesFlowTriggerRelease configuration: 'Thunder-CD', parameters: '{"release":{"releaseName":"tj-Spring-Boot-WebSocket", "stages":[{"stageName":"Release Readiness","stageValue":true},{"stageName":"Pre-Prod","stageValue":true},{"stageName":"Prod","stageValue":true}], "pipelineName":"pipeline_tj-Spring-Boot-WebSocket","parameters":[]}}', projectName: 'tjohnson Demo', releaseName: 'tj-Spring-Boot-WebSocket', startingStage: 'Release Readiness'
}
}
}
}