From cc02c29f2016ccee6c9a161c260c58d3c97e751c Mon Sep 17 00:00:00 2001 From: andyjk15 Date: Mon, 17 Feb 2020 16:04:05 +0000 Subject: [PATCH] [17.02.20] Setup kubernetes auth and bring back github tagging --- configuration/pipelines/build.groovy | 31 +++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/configuration/pipelines/build.groovy b/configuration/pipelines/build.groovy index e2a9a55..ae9d6cb 100644 --- a/configuration/pipelines/build.groovy +++ b/configuration/pipelines/build.groovy @@ -79,13 +79,26 @@ try { sh "sed -it 's/RESOURCE_NAME/${env.APPLICATION_NAME}/g' configuration/kubernetes/service.yaml" sh "sed -it 's/LABEL/${env.APPLICATION_LABEL}/g' configuration/kubernetes/service.yaml" - } stage('Deploy') { - - deploy( 1 ) + withCredentials([kubeconfigContent(credentialsId: 'Kubernetes', variable: 'CONFIG')]) { + echo $CONFIG + } +// kubernetesDeploy(kubeconfigId: 'Kubernetes', // REQUIRED +// +// configs: '', // REQUIRED +// enableConfigSubstitution: false, +// +// secretNamespace: "${env.NAMESPACE}", +// secretName: '', +// dockerCredentials: [ +// [credentialsId: ''], +// [credentialsId: '', url: ''], +// ] +// ) + deploy() } stage('Tag Repository') { @@ -94,8 +107,20 @@ try { withDockerRegistry([credentialsId: 'Registry', url: "${env.DOCKER_REPOSITORY_URL}"]) { def image = docker.build("${env.DOCKER_REPOSITORY}/db-gateway:${env.APPLICATION_VERSION}") image.push() + def latest = docker.build("${env.DOCKER_REPOSITORY}/db-gateway:latest") + latest.push() } } + withCredentials( + [usernamePassword( + credentialsId: env.BITBUCKET_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}" + } } } }