-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkins-pipeline
49 lines (46 loc) · 1.33 KB
/
jenkins-pipeline
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
pipeline {
environment {
registry = "snicholsonqualys/demo-builds"
registryCredential = 'dockerhub'
}
agent any
stages {
stage('Cloning Git') {
steps {
git 'https://github.com/snicholson-qualys/ubuntu-demo.git'
}
}
stage('Building Image') {
steps{
script {
customImage = docker.build registry + ":fail"
buildNum = registry + ":fail"
//def IMAGE_ID = sh(script: "docker images -q $buildNum")
IMAGE_ID = sh(script: "docker images -q '$buildNum'", returnStdout: true).trim()
env.IMAGE_ID = IMAGE_ID
}
}
}
stage('Access with Qualys') {
steps{
script{
getImageVulnsFromQualys imageIds: env.IMAGE_ID, useGlobalConfig:true
}
}
}
stage('Push to Docker') {
steps{
script{
docker.withRegistry( '', registryCredential ) {
customImage.push()
}
}
}
}
}
post('Remove Unused docker image'){
always{
sh "docker rmi $registry:fail"
}
}
}