mirror of
https://github.com/chillout2k/sos-milter.git
synced 2025-12-12 18:10:18 +00:00
Jenkins scripted multibranch pipeline
This commit is contained in:
parent
8f7b83d60a
commit
9c0b4b943a
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@ -1,21 +1,24 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
environment {
|
|
||||||
dockerImage = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
parameters {
|
parameters {
|
||||||
string name: 'dockerRegistry', trim: true
|
string name: 'dockerRegistry', trim: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
dockerImage = ''
|
||||||
|
imageName = 'sos-milter'
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build image') {
|
stage('Build image') {
|
||||||
steps {
|
steps {
|
||||||
sh '/usr/bin/env'
|
sh '/usr/bin/env'
|
||||||
script {
|
script {
|
||||||
/* Multi-Branch Pipeline works with env.BRANCH_NAME*/
|
dockerImage = docker.build(
|
||||||
dockerImage = docker.build("sos-milter:${env.BRANCH_NAME}","--pull --label BUILD_URL=${env.BUILD_URL} .")
|
"${env.imageName}:${env.BRANCH_NAME}",
|
||||||
|
"--pull --label BUILD_URL=${env.BUILD_URL} ."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,6 +26,7 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
dockerImage.inside {
|
dockerImage.inside {
|
||||||
|
sh 'echo "INSIDE CONTAINER!"'
|
||||||
sh '/usr/bin/env'
|
sh '/usr/bin/env'
|
||||||
sh '/bin/ps auxwwf'
|
sh '/bin/ps auxwwf'
|
||||||
}
|
}
|
||||||
@ -40,7 +44,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage('Cleanup') {
|
stage('Cleanup') {
|
||||||
steps {
|
steps {
|
||||||
sh 'echo "TODO: cleanup!"'
|
sh '/usr/bin/docker rmi ${env.imageName}:${env.BRANCH_NAME}'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user