From 98730dde31917e7fa2c4c1ee01792d8f7353dba7 Mon Sep 17 00:00:00 2001 From: Rustam Tagaev Date: Fri, 20 Dec 2024 16:27:23 +0300 Subject: [PATCH] hotfix/DO-00/some_refactoring (!59) Co-authored-by: Rustam Tagaev Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/59 --- .../Cloud/Deploy/openresty-deploy.groovy | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/pipelines/Cloud/Deploy/openresty-deploy.groovy b/pipelines/Cloud/Deploy/openresty-deploy.groovy index be89296..4dc1924 100644 --- a/pipelines/Cloud/Deploy/openresty-deploy.groovy +++ b/pipelines/Cloud/Deploy/openresty-deploy.groovy @@ -19,6 +19,7 @@ String valuesPath = 'avroid.local/api-gateway/openresty' String namespace = 'api-gateway' String helmChart = 'openresty' String helmRepoPath = 'avroid/openresty' +String helmRepo = "${env.JENKINS_NEXUS_URL}/repository/avroid-charts" Map configuration = [ vaultUrl: env.JENKINS_VAULT_URL, @@ -40,46 +41,44 @@ PodTemplates slaveTemplates = new PodTemplates(this, env.JENKINS_DOCKER_REGISTRY slaveTemplates.jnlp { slaveTemplates.helm { - slaveTemplates.kubectl { - try { - node(POD_LABEL){ - withVault([configuration: configuration, vaultSecrets: dockerCreds]) { - stage('get repo with values'){ - gitVars = git.clone([urlRepo: "${env.JENKINS_GIT_REPOSITORY_SSH_URL}/${repoPath}", - branch: branch]) - } - container('helm'){ - stage('deploy'){ - dir(valuesPath){ - sh """#!/bin/sh - helm repo add avroid ${env.JENKINS_NEXUS_URL}/repository/devops-helm-release - helm -n ${namespace} upgrade -f values.yaml --install ${helmChart} ${helmRepoPath} - """ - } + try { + node(POD_LABEL){ + withVault([configuration: configuration, vaultSecrets: dockerCreds]) { + stage('get repo with values'){ + gitVars = git.clone([urlRepo: "${env.JENKINS_GIT_REPOSITORY_SSH_URL}/${repoPath}", + branch: branch]) + } + container('helm'){ + stage('deploy'){ + dir(valuesPath){ + sh """#!/bin/sh + helm repo add avroid ${helmRepo} + helm -n ${namespace} upgrade -f values.yaml \ + --install ${helmChart} ${helmRepoPath} + """ } } } } - } catch(err) { - errorMessage = err.getMessage() - - println 'ERROR: ' + errorMessage - - currentBuild.result = 'FAILURE' - - String currentBuildUser = Jenkins.GetCurrentBuildUser(script: this) - String emailSubject = "${currentBuild.currentResult}. " + - "Pipeline task: ${currentBuild.fullDisplayName}" - - Notifications.email( - script: this, - subject: emailSubject, - errorString: errorMessage, - recipientProviders: [], - to: "${currentBuildUser}@avroid.team" - ) } + } catch(err) { + errorMessage = err.getMessage() + println 'ERROR: ' + errorMessage + + currentBuild.result = 'FAILURE' + + String currentBuildUser = Jenkins.GetCurrentBuildUser(script: this) + String emailSubject = "${currentBuild.currentResult}. " + + "Pipeline task: ${currentBuild.fullDisplayName}" + + Notifications.email( + script: this, + subject: emailSubject, + errorString: errorMessage, + recipientProviders: [], + to: "${currentBuildUser}@avroid.team" + ) } } }