[17.02.20] Setup kubernetes auth and bring back github tagging

This commit is contained in:
andyjk15 2020-02-17 16:04:05 +00:00
parent 56565ec3d1
commit cc02c29f20

View File

@ -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: '<ant-glob-pattern-for-resource-config-paths>', // REQUIRED
// enableConfigSubstitution: false,
//
// secretNamespace: "${env.NAMESPACE}",
// secretName: '<secret-name>',
// dockerCredentials: [
// [credentialsId: '<credentials-id-for-docker-hub>'],
// [credentialsId: '<credentials-id-for-other-private-registry>', url: '<registry-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}"
}
}
}
}