forked from snyk-labs/nodejs-goof
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathJenkinsfile
70 lines (65 loc) · 2.24 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
#!/usr/bin/env groovy
node ('master') {
git url: GIT_URL
def rtServer = Artifactory.newServer url: "http://jfrog.local/artifactory", credentialsId: CREDENTIALS
def buildInfo = Artifactory.newBuildInfo()
def tagDockerApp
def rtDocker
buildInfo.env.capture = true
stage('Resolve') {
def downloadSpec = """{
"files": [
{
"pattern": "jcenter-cache/junit/junit/3.8.1/junit-3.8.1.jar",
"target": "./",
"flat":"true"
}
]
}"""
println(downloadSpec)
rtServer.download(downloadSpec, buildInfo)
}
stage('deploy') {
def uploadSpec = """{
"files": [
{
"pattern": "junit*.*",
"target": "libs-release-local/junit/junit/3.8.1/junit-3.8.1.jar"
}
]
}"""
rtServer.upload(uploadSpec, buildInfo)
}
stage ('build & deploy') {
tagDockerApp = "jfrog.local:5001/goofy:${env.BUILD_NUMBER}"
docker.build(tagDockerApp)
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: CREDENTIALS, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
rtDocker = Artifactory.docker("${env.USERNAME}", "${env.PASSWORD}")
rtDocker.push(tagDockerApp, 'docker-stage-local', buildInfo)
rtServer.publishBuildInfo buildInfo
}
}
stage('Xray Scan') {
def xrayConfig = [
'buildName' : env.JOB_NAME,
'buildNumber' : env.BUILD_NUMBER,
'failBuild' : false
]
def xrayResults = rtServer.xrayScan xrayConfig
echo xrayResults as String
}
stage ('promotion') {
def promotionConfig = [
'buildName' : env.JOB_NAME,
'buildNumber' : env.BUILD_NUMBER,
'targetRepo' : 'docker-prod-local',
'comment' : 'App works with latest released version of gradle swampup app, tomcat and jdk',
'sourceRepo' : 'docker-stage-local',
'status' : 'Released',
'includeDependencies': false,
'copy' : true,
'failFast' : false
]
rtServer.promote promotionConfig
}
}