[25.06.20] Changed for DO registry and new cluster

This commit is contained in:
andyjk15 2020-06-25 23:45:49 +01:00
parent 04ee311003
commit d8516c358e

View File

@ -6,9 +6,10 @@ env.GIT_BRANCH = 'master'
env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}.git" env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}.git"
env.GIT_REPOSITORY_URL = "https://${env.GIT_REPOSITORY_PATH}" env.GIT_REPOSITORY_URL = "https://${env.GIT_REPOSITORY_PATH}"
env.GITHUB_CREDENTIALS_ID = 'Github' env.GITHUB_CREDENTIALS_ID = 'Github'
env.DOCKER_REPOSITORY = 'registry.digitalocean.com/cryptosky-image-registry' env.DIGITAL_OCEAN = 'registry.digitalocean.com'
env.DOCKER_REPOSITORY = "${env.DIGITAL_OCEAN}/cryptosky-image-registry"
env.DOCKER_REPOSITORY_URL = "https://${env.DOCKER_REPOSITORY}" env.DOCKER_REPOSITORY_URL = "https://${env.DOCKER_REPOSITORY}"
env.DOCKER_REPOSITORY_TCP = "tcp://registry.digitalocean.com" env.DOCKER_REPOSITORY_TCP = "tcp://${env.DIGITAL_OCEAN}"
env.NAMESPACE = 'production' env.NAMESPACE = 'production'
env.SLAVE_LABEL = "cryptosky-aio-build" env.SLAVE_LABEL = "cryptosky-aio-build"
@ -44,7 +45,8 @@ try {
)] )]
) { ) {
sh "doctl auth init --access-token ${DOCTL_TOKEN}" sh "doctl auth init --access-token ${DOCTL_TOKEN}"
// sh "doctl kubernetes cluster kubeconfig save cryptosky-kubernetes-cluster-production" sh "doctl registry login"
sh "doctl kubernetes cluster kubeconfig save cryptosky-kubernetes-cluster"
} }
} }
@ -73,14 +75,15 @@ try {
stage('Tag Repository') { stage('Tag Repository') {
// withDockerServer([uri: "${env.DOCKER_REPOSITORY_TCP}"]) { def image = docker.build("db-gateway:${env.APPLICATION_VERSION}")
withDockerRegistry([credentialsId: 'DORegistry', url: "${env.DOCKER_REPOSITORY_URL}"]) { def latest = docker.build("db-gateway:latest")
def image = docker.build("db-gateway:${env.APPLICATION_VERSION}")
image.push() sh "docker tag ${image} ${env.DOCKER_REPOSITORY}/${image}"
def latest = docker.build("db-gateway:latest") sh "docker tag ${latest} ${env.DOCKER_REPOSITORY}/${latest}"
latest.push()
} sh "docker push ${env.DOCKER_REPOSITORY}/${image}"
// } sh "docker push ${env.DOCKER_REPOSITORY}/${latest}"
withCredentials( withCredentials(
[usernamePassword( [usernamePassword(
credentialsId: env.GITHUB_CREDENTIALS_ID, credentialsId: env.GITHUB_CREDENTIALS_ID,