hotfix/DO-00/some_refactoring (!59)
Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.tech> Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/59
This commit is contained in:
@@ -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"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user