diff --git a/JenkinsFileBuildAndDeployIntegration b/JenkinsFileBuildAndDeployIntegration index fad2eca4..b61a157c 100644 --- a/JenkinsFileBuildAndDeployIntegration +++ b/JenkinsFileBuildAndDeployIntegration @@ -14,6 +14,8 @@ def sendPerSlack(color, status) { slackSend color: color, message: "${status}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL}) - Committer: ${committerEmail} - Job started by: ${buildUser}" } +def repositoryUrl + node { //Setup nodeJS from nodeJS Jenkins Plugin @@ -23,6 +25,7 @@ node { try { stage('Checkout') { checkout scm + repositoryUrl = sh(returnStdout: true, script: 'git config remote.origin.url').trim().substring('https://'.length()) sendPerSlack('#000000', "STARTED") } @@ -48,6 +51,13 @@ node { sh "npm run test:selenium" } + stage('Create Git Tag') { + withCredentials([usernamePassword(credentialsId: 'b07c4ef3-6b1b-4de1-8ba2-489266971e9a', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { + sh "git tag -a 'build-${env.BUILD_NUMBER}' -m 'Successful build-${env.BUILD_NUMBER}'" + sh "git push https://\${GIT_USERNAME}:\${GIT_PASSWORD}@${repositoryUrl} --tags" + } + } + currentBuild.result = 'SUCCESS' } catch (e) { currentBuild.result = 'FAILED'