diff --git a/Jenkinsfile b/Jenkinsfile index 704e29ecd..0e1159451 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - DOCKER_PASSWORD = credentials("docker_password") + DOCKER_PASSWORD = credentials("springoutside_password") } stages { @@ -10,5 +10,18 @@ pipeline { sh './gradlew clean build' } } + stage('Tag image') { + steps { + script { + GIT_TAG = sh([script: 'git fetch --tag && git tag', returnStdout: true]).trim() + MAJOR_VERSION = sh([script: 'git tag | cut -d . -f 1', returnStdout: true]).trim() + MINOR_VERSION = sh([script: 'git tag | cut -d . -f 2', returnStdout: true]).trim() + PATCH_VERSION = sh([script: 'git tag | cut -d . -f 3', returnStdout: true]).trim() + } + sh "docker build -t springoutside/hello-img:${MAJOR_VERSION}.\$((${MINOR_VERSION} + 1)).${PATCH_VERSION} ." + } + } } + + }