Test deployment to vapor with dynamic commit message from git

This commit is contained in:
Dillon Ngo
2023-11-23 14:25:29 +08:00
parent 9d8377c0ed
commit d7f41b1828
Vendored
+4 -12
View File
@@ -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"'
}
}