diff --git a/configuration/pipelines/build.groovy b/configuration/pipelines/build.groovy index b4fd3ba..b907459 100644 --- a/configuration/pipelines/build.groovy +++ b/configuration/pipelines/build.groovy @@ -6,7 +6,8 @@ env.GIT_BRANCH = 'master' env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}.git" env.GIT_REPOSITORY_URL = "https://${env.GIT_REPOSITORY_PATH}" env.GITHUB_CREDENTIALS_ID = 'Registry' -env.DOCKER_REPOSITORY = 'https://registry.cryptosky.me' +env.DOCKER_REPOSITORY = 'registry.cryptosky.me' +env.DOCKER_REPOSITORY_URL = "https://${env.DOCKER_REPOSITORY}" env.NAMESPACE = 'production' env.SLAVE_LABEL = "cryptosky-aio-build" @@ -60,7 +61,7 @@ try { stage('Build Image') { mvn 'clean package -DskipTests' - + sh "docker build -t db-gateway:${env.APPLICATION_VERSION} -f Dockerfile ." // Update build config for kubernetes // Update Service yaml for kubernetes @@ -71,20 +72,16 @@ try { stage('Deploy') { // Update/map secret.yaml if needed + + deploy( 1 ) } stage('Tag Repository') { - withCredentials( - [usernamePassword( - credentialsId: env.GITHUB_CREDENTIALS_ID, - passwordVariable: 'GIT_PASSWORD', - usernameVariable: 'GIT_USERNAME' - )] - ) { - sh "git tag ${env.APPLICATION_VERSION}" - sh "git push https://${GIT_USERNAME}:${GIT_PASSWORD}@${env.GIT_REPOSITORY_PATH} ${env.APPLICATION_VERSION}" - } + sh "docker tag db-gateway:${env.APPLICATION_VERSION} ${env.DOCKER_REPOSITORY_URL}/db-gateway:${env.APPLICATION_VERSION}" + withDockerRegistry([ credentialsId: 'Registry', url: "${env.DOCKER_REPOSITORY_URL}"]) { + sh "docker push ${env.DOCKER_REPOSITORY_URL}/db-gateway:${env.APPLICATION_VERSION}" + } } } }