mirror of
https://github.com/chillout2k/sos-milter.git
synced 2025-12-11 01:30:19 +00:00
Jenkins scripted multibranch pipeline
This commit is contained in:
parent
d5d2bc2263
commit
8f7b83d60a
65
Jenkinsfile
vendored
65
Jenkinsfile
vendored
@ -1,29 +1,48 @@
|
|||||||
node {
|
pipeline {
|
||||||
def app
|
agent any
|
||||||
|
|
||||||
/* stage('Clone repository') {
|
environment {
|
||||||
sh '/usr/bin/env'
|
dockerImage = ''
|
||||||
checkout scm
|
|
||||||
}*/
|
|
||||||
|
|
||||||
stage('Build image') {
|
|
||||||
sh '/usr/bin/env'
|
|
||||||
/* Multi-Branch Pipeline works with env.BRANCH_NAME*/
|
|
||||||
app = docker.build("sos-milter:${env.BRANCH_NAME}","--pull --label BUILD_URL=${env.BUILD_URL} .")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Test image') {
|
parameters {
|
||||||
app.inside {
|
string name: 'dockerRegistry', trim: true
|
||||||
sh '/usr/bin/env'
|
}
|
||||||
sh '/bin/ps auxwwf'
|
|
||||||
|
stages {
|
||||||
|
stage('Build image') {
|
||||||
|
steps {
|
||||||
|
sh '/usr/bin/env'
|
||||||
|
script {
|
||||||
|
/* Multi-Branch Pipeline works with env.BRANCH_NAME*/
|
||||||
|
dockerImage = docker.build("sos-milter:${env.BRANCH_NAME}","--pull --label BUILD_URL=${env.BUILD_URL} .")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Test image') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
dockerImage.inside {
|
||||||
|
sh '/usr/bin/env'
|
||||||
|
sh '/bin/ps auxwwf'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Push image') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
docker.withRegistry(env.dockerRegistry) {
|
||||||
|
dockerImage.push()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Cleanup') {
|
||||||
|
steps {
|
||||||
|
sh 'echo "TODO: cleanup!"'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Push image') {
|
|
||||||
app.push()
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Cleanup') {
|
|
||||||
sh 'echo "TODO: cleanup!"'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user