From da2963bf24a4f480c2b978b1de07cfde2bd36a7c Mon Sep 17 00:00:00 2001 From: NetOps <idcnetops@tarento.com> Date: Thu, 27 Jan 2022 09:09:24 +0000 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3b0e0eb..fa04149 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,6 +10,9 @@ node() { stage('Checkout') { cleanWs() checkout scm + commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() + env.commit_id = sh(script: "echo " + "form" + "_" + commit_hash + "_" + env.BUILD_NUMBER, returnStdout: true).trim() + echo "${env.commit_id}" } } stage('docker-pre-build') { @@ -38,6 +41,12 @@ node() { docker rmi -f $docker_server/$docker_repo:$commit_id ''' } + stage('ArchiveArtifacts') { + sh ("echo ${commit_id} > commit_id.txt") + archiveArtifacts "commit_id.txt" + currentBuild.description = "${commit_id}" + } + } catch (err) { -- GitLab