From d7f41b18286fa2d6dcdc806e943578038fa29932 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Thu, 23 Nov 2023 14:25:29 +0800 Subject: [PATCH] Test deployment to vapor with dynamic commit message from git --- Jenkinsfile | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7e3fdd25..e05862b0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,21 +19,13 @@ pipeline { stages { stage('Download source code from Git') { steps { - git( + scmVars = git( url: httpUrl, credentialsId: 'gitlab-jenkins-localhost', branch: 'dillon/34-jenkins-vapor' ) - } - } - - stage('Get Commit Message for Deployment') { - steps { - script { - gitExecutable = tool 'Git' - commit = sh(returnStdout: true, script: "${gitExecutable}/bin/git log -1 --oneline").trim() - env.GIT_COMMIT_MSG = commit - } + commitHash = scmVars.GIT_COMMIT + echo commitHash } } @@ -51,7 +43,7 @@ pipeline { stage('Deploy') { steps { - sh 'vendor/bin/vapor deploy staging --message=${GIT_COMMIT_MSG}' + sh 'vendor/bin/vapor deploy staging --message="Test Jenkins"' } }