-
Notifications
You must be signed in to change notification settings - Fork 27
/
Jenkinsfile
39 lines (37 loc) · 905 Bytes
/
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
def abortPreviousRunningBuilds() {
def hi = Hudson.instance
def pname = env.JOB_NAME.split('/')[0]
hi.getItem(pname).getItem(env.JOB_BASE_NAME).getBuilds().each{ build ->
def exec = build.getExecutor()
if (build.number != currentBuild.number && exec != null) {
exec.interrupt(
Result.ABORTED,
new CauseOfInterruption.UserInterruption(
"Aborted by #${currentBuild.number}"
)
)
println("Aborted previous running build #${build.number}")
}
}
}
pipeline {
agent any
stages {
stage('build') {
steps {
ansiColor('xterm') {
abortPreviousRunningBuilds()
sh 'node create-Dockerfile.js > Dockerfile'
sh 'docker build -t test .'
}
}
}
stage('test') {
steps {
ansiColor('xterm') {
sh 'docker run --shm-size="1024m" --security-opt seccomp=unconfined test'
}
}
}
}
}