Some checks failed
tv7playlist/pipeline/head There was a failure building this commit
53 lines
1.0 KiB
Groovy
53 lines
1.0 KiB
Groovy
// Multi-branch pipeline. Build once on wednesday from a "master" branch only
|
|
CRON_SETTINGS = BRANCH_NAME == "master" ? '''H H * * 3'''
|
|
|
|
pipeline {
|
|
environment {
|
|
imagename = "phaefelfinger/tv7playlist"
|
|
registryCredential = 'phdockerhub'
|
|
dockerImage = ''
|
|
}
|
|
|
|
agent { node { label 'docker' } }
|
|
|
|
triggers {
|
|
cron(CRON_SETTINGS)
|
|
}
|
|
|
|
stages {
|
|
stage('Cloning repository') {
|
|
steps {
|
|
checkout scm
|
|
}
|
|
}
|
|
|
|
stage('Building image') {
|
|
steps{
|
|
script {
|
|
dockerImage = docker.build imagename
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Publishing image') {
|
|
steps{
|
|
script {
|
|
docker.withRegistry( '', registryCredential ) {
|
|
dockerImage.push('latest')
|
|
dockerImage.push('3.1')
|
|
dockerImage.push('3.1.0')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Remove unused docker image') {
|
|
steps{
|
|
sh "docker rmi $imagename:latest"
|
|
sh "docker rmi $imagename:3.1"
|
|
sh "docker rmi $imagename:3.1.0"
|
|
}
|
|
}
|
|
}
|
|
}
|