From 1bc0de39ce910a79bc5515980bed28a57953f980 Mon Sep 17 00:00:00 2001 From: "seonkyu.kim" Date: Fri, 12 Jul 2024 12:44:36 +0900 Subject: [PATCH] =?UTF-8?q?[=F0=9F=91=B7]=20Jenkins=20Test4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 2b492b5..bd70a54 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,4 +39,20 @@ pipeline { } } } + + post { + always { + script { + def containerId = sh(script: "docker ps -qf 'name=${DOCKER_CONTAINER_NAME}'", returnStdout: true).trim() + if (containerId) { + sh "docker logs ${containerId}" + } else { + echo "Docker container ${DOCKER_CONTAINER_NAME} not found" + } + } + } + failure { + echo "Build failed. Check the console output for details." + } + } } \ No newline at end of file