-
Notifications
You must be signed in to change notification settings - Fork 14
/
jenkinsfile
89 lines (86 loc) · 2.53 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
pipeline {
agent any
tools {
maven 'Maven'
}
stages {
stage('Build') {
steps {
echo 'Building'
sh 'mvn -X clean install -DskipTests'
}
}
stage('Test') {
steps {
echo 'Testing'
catchError {
sh 'mvn test'
}
echo currentBuild.result
}
post {
always {
junit '**/target/surefire-reports/*.xml'
}
}
}
stage('Veracode') {
steps {
echo 'Security Testing'
catchError {
snDevOpsSecurityResult(securityResultAttributes:
"{
'scanner': 'Veracode',
'applicationName': 'PetStoreAPI-Github',
'securityToolId' : '8462c9c6c32f351027b51185e001311c'}" )
}
}
}
stage('Create Artifact for prod') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
echo 'Creating artifact'
sh 'mvn package'
sleep 3
snDevOpsArtifact(artifactsPayload:"""
{"artifacts":
[
{
"name": "mavenDemoProject-mvp.jar",
"version":"0.${env.BUILD_NUMBER}.0",
"semanticVersion": "0.${env.BUILD_NUMBER}.0",
"repositoryName": "bicycle-artifacts-repo"
}
]
}""")
snDevOpsPackage(name: 'avgbicycleewingapp', artifactsPayload: """
{"artifacts":
[
{
"name": "mavenDemoProject-mvp.jar",
"repositoryName": "bicycle-artifacts-repo",
"pipelineName": "maven-buiild-pipeline",
"taskExecutionNumber":"${env.BUILD_NUMBER}",
"stageName":"Create Artifact for prod",
"branchName": "master"
}
]
}""")
}
}
stage('Deploy') {
steps {
snDevOpsChange()
script{
changeNumber = snDevOpsGetChangeNumber()
echo '>> Deploy in prod'
sh "echo ${changeNumber}"
}
}
}
}
}