forked from sysdiglabs/dummy-vuln-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
68 lines (64 loc) · 1.72 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
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
metadata:
name: dind
annotations:
container.apparmor.security.beta.kubernetes.io/dind: unconfined
container.seccomp.security.alpha.kubernetes.io/dind: unconfined
spec:
containers:
- name: dind
image: docker:dind
securityContext:
privileged: true
tty: true
volumeMounts:
- name: var-run
mountPath: /var/run
- name: jnlp
securityContext:
runAsUser: 0
fsGroup: 0
volumeMounts:
- name: var-run
mountPath: /var/run
volumes:
- emptyDir: {}
name: var-run
"""
}
}
parameters {
string(name: 'DOCKER_REPOSITORY', defaultValue: 'sysdigcicd/cronagent', description: 'Name of the image to be built (e.g.: sysdiglabs/dummy-vuln-app)')
}
environment {
DOCKER = credentials('docker-repository-credentials')
}
stages {
stage('Checkout') {
steps {
container("dind") {
checkout scm
}
}
}
stage('Build Image') {
steps {
container("dind") {
sh "docker build -f Dockerfile -t ${params.DOCKER_REPOSITORY} ."
sh "echo ${params.DOCKER_REPOSITORY} > sysdig_secure_images"
}
}
}
stage('Scanning Image') {
steps {
// This will always be executed in the JNLP container
sysdig engineCredentialsId: 'sysdig-secure-api-credentials', name: 'sysdig_secure_images', inlineScanning: true
}
}
}
}