From f468ea1294790300a803711c65f08c17ca0bea91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Wed, 23 Oct 2019 07:23:49 -0700 Subject: [PATCH] added post action --- Jenkins/master-pipeline/Jenkinsfile | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Jenkins/master-pipeline/Jenkinsfile b/Jenkins/master-pipeline/Jenkinsfile index d43c851..4a45c53 100644 --- a/Jenkins/master-pipeline/Jenkinsfile +++ b/Jenkins/master-pipeline/Jenkinsfile @@ -16,7 +16,11 @@ pipeline { agent any triggers { pollSCM 'H H/2 * * *' - } + } + environment { + BUILD_ID='${JOB_BASE_NAME}-${BUILD_NUMBER}' + TARGET_DIR='/mnt/nfs/results/${BUILD_ID}' + } stages { stage("git checkout"){ steps { @@ -50,4 +54,20 @@ pipeline { } } } + post { + always { + echo 'Postprocessing...' + // log console log to file + script { + def logContent = Jenkins.getInstance() + .getItemByFullName(env.JOB_NAME) + .getBuildByNumber( + Integer.parseInt(env.BUILD_NUMBER)) + .logFile.text + writeFile file: "console-log.txt", text: logContent + } + sh 'cp console-log.txt ${env.TARGET_DIR}' + echo 'Console log is available at https://results.new.llvm-mgerge-guards/${env.BUILD_ID}' + } + } } \ No newline at end of file