From bde4926c5f7378d9b923e7d3f8cb4c5a5c6dbf8c Mon Sep 17 00:00:00 2001 From: Tom Ruff Date: Sat, 25 Jan 2025 18:22:29 +0200 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bbe9435..38304e6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,7 +57,7 @@ pipeline { } stage('Clean Old Container') { steps { - catchError(buildResult: 'SUCCESS',message: 'Container doesn\'t exist on host, skipping...', stageResult: 'ABORTED') { + catchError(buildResult: 'SUCCESS', message: 'Container doesn\'t exist on host, skipping...', stageResult: 'ABORTED') { sh 'docker stop otomai' sh 'docker rm otomai' } @@ -73,11 +73,21 @@ pipeline { // Login to registry docker.withRegistry('https://git.ruff.co.il', registryCredentialsId) { - // Run container on build + // Run container docker.image(imageName).run('-p 10002:80 --name otomai') } } } } } + post { + success { + // Trigger the deploy-prod-job on success of the build + build job: 'deploy-prod-job', wait: false + } + failure { + // Optionally, you can handle failure scenarios (e.g., notify team, etc.) + echo "Build failed, deployment not triggered." + } + } }