You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
3.6 KiB
123 lines
3.6 KiB
pipeline {
|
|
agent {
|
|
node {
|
|
label 'MachineSlave1'
|
|
}
|
|
}
|
|
environment {
|
|
SUCCESS = 'true'
|
|
STAGE = 'none'
|
|
IMAGE_DOCKER = 'registry.vodorod.cl/deal/tienda-playa-servicio:latest'
|
|
}
|
|
stages {
|
|
stage('Quarkus Compile') {
|
|
steps {
|
|
sh 'chmod +x mvnw && ./mvnw package -Dquarkus.package.type=uber-jar -Dquarkus.profile=prod'
|
|
}
|
|
post {
|
|
success {
|
|
script {
|
|
SUCCESS = 'true'
|
|
STAGE = 'Quarkus Compile'
|
|
}
|
|
}
|
|
failure {
|
|
script {
|
|
SUCCESS = 'false'
|
|
STAGE = 'Quarkus Compile'
|
|
}
|
|
}
|
|
aborted {
|
|
script {
|
|
SUCCESS = 'false'
|
|
STAGE = 'Quarkus Compile'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Docker Build') {
|
|
when { equals expected: 'true', actual: SUCCESS }
|
|
steps {
|
|
sh 'docker build -t ${IMAGE_DOCKER} .'
|
|
}
|
|
post {
|
|
success {
|
|
script {
|
|
SUCCESS = 'true'
|
|
STAGE = 'Docker Build'
|
|
}
|
|
}
|
|
failure {
|
|
script {
|
|
SUCCESS = 'false'
|
|
STAGE = 'Docker Build'
|
|
}
|
|
}
|
|
aborted {
|
|
script {
|
|
SUCCESS = 'false'
|
|
STAGE = 'Docker Build'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Docker Push') {
|
|
when { equals expected: 'true', actual: SUCCESS }
|
|
steps {
|
|
withCredentials([usernamePassword(credentialsId: 'vodorodRegistry', passwordVariable: 'vodorodRegistryPassword', usernameVariable: 'vodorodRegistryUser')]) {
|
|
sh "docker login registry.vodorod.cl -u ${env.vodorodRegistryUser} -p ${env.vodorodRegistryPassword}"
|
|
sh 'docker push ${IMAGE_DOCKER}'
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
script {
|
|
SUCCESS = 'true'
|
|
STAGE = 'Docker Push'
|
|
}
|
|
}
|
|
failure {
|
|
script {
|
|
SUCCESS = 'false'
|
|
STAGE = 'Docker Push'
|
|
}
|
|
}
|
|
aborted {
|
|
script {
|
|
SUCCESS = 'false'
|
|
STAGE = 'Docker Push'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
script {
|
|
withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'), string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
|
|
sh """
|
|
curl -s -X POST https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id=${CHAT_ID} -d parse_mode="HTML" -d text="<b>Project</b> : ${env.JOB_NAME} \n<b>Branch</b>: ${BRANCH_NAME} \n<b>Build </b> : Complete \n<b>Status</b> : Passed \n<b>Node</b> : ${env.NODE_NAME}"
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
failure {
|
|
script {
|
|
withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'), string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
|
|
sh """
|
|
curl -s -X POST https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id=${CHAT_ID} -d parse_mode="HTML" -d text="<b>Project</b> : ${env.JOB_NAME} \n<b>Branch</b>: ${BRANCH_NAME} \n<b>Build </b> : ${STAGE} \n<b>Status</b> : Failed \n<b>Node</b> : ${env.NODE_NAME}"
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
aborted {
|
|
script {
|
|
withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'), string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
|
|
sh """
|
|
curl -s -X POST https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id=${CHAT_ID} -d parse_mode="HTML" -d text="<b>Project</b> : ${env.JOB_NAME} \n<b>Branch</b>: ${BRANCH_NAME} \n<b>Build </b> : ${STAGE} \n<b>Status</b> : Aborted \n<b>Node</b> : ${env.NODE_NAME}"
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |