Commit 1d0bcf2c authored by Ndoumbe's avatar Ndoumbe

Update Jenkinsfile.shared

parent 4b366b48
@Library("share-library") _ // Load the shared library from the repository test for demo
@Library('shared-jenkins-pipeline') _
def COLOR_MAP = [ template {
'SUCCESS': 'good', applicationName = "odoo-demo"
'FAILURE': 'danger', VALUES_FILE = "values-odoo-demo.yaml"
] imageName = "ndiop/odoo-demo"
pipeline {
environment
{
// test variable: 0=success, 1=fail; must be string
doError = '0'
GIT_COMMIT_MSG = sh(returnStdout: true, script: "git log -1 --pretty=%B").trim()
GITLAB_TOKEN_ID = 'gitlab_credential'
PROJECT = 'odoo-demo'
IMAGE_NAME = 'ndiop/odooimg'
BRANCH_NAME = "${GIT_BRANCH.split("/")[1]}"
SHORT_COMMIT = "${GIT_COMMIT[0..7]}"
DOCKER_BUILDKIT=1
}
agent any
stages
{
stage ('Building main Docker image')
{
when {
expression { BRANCH_NAME == 'dev' || BRANCH_NAME == 'master' }
}
steps
{
sh "mkdir -p $WORKSPACE/modules"
BuildImage(projectFolder:"odoo-demo",targetName:"dev")
}
}
stage('Status') {
steps{
GetStatus(env.doError)
}
}
}
// Post-build actions
post {
success {
slackSend channel: '#demo',
color: COLOR_MAP[currentBuild.currentResult],
message: "*${currentBuild.currentResult}:* JOB ${env.JOB_NAME} | BUILD N° = ${env.BUILD_NUMBER}\n Plus d'infos: ${env.BUILD_URL} \n Une nouvelle image est disponible pour le projet WAQF\n Message du commit : ${env.GIT_COMMIT_MSG} \n Lien du commit: http://gitlab.baamtu.com/olimata.sy/waqf/commit/${env.GIT_COMMIT} "
}
failure {
slackSend channel: '#demo',
color: COLOR_MAP[currentBuild.currentResult],
message: "*${currentBuild.currentResult}:* JOB ${env.JOB_NAME} | BUILD N° = ${env.BUILD_NUMBER}\n Plus d'infos: ${env.BUILD_URL} \n Message du commit : ${env.GIT_COMMIT_MSG} \n Lien du commit: http://gitlab.baamtu.com/olimata.sy/waqf/commit/${env.GIT_COMMIT}"
}
} }
\ No newline at end of file
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment