change build way

This commit is contained in:
2024-11-05 10:09:01 +03:00
parent 73ccc07687
commit 87406ece88
4 changed files with 13 additions and 58 deletions
+11 -10
View File
@@ -10,13 +10,15 @@ node("docker") {
stage("Prepare environments") {
if (env.BRANCH_NAME == 'master')
envConfig = "build/vars/master.yaml"
env.stand = "prod"
else if (env.BRANCH_NAME == 'dev')
envConfig = "build/vars/dev.yaml"
env.stand = "test"
else
error("Unsupported branch: ${env.BRANCH_NAME}")
envConfig = "build/vars/build.yaml"
support.getVarsV2(envConfig)
println "Success prepare"
}
@@ -35,15 +37,14 @@ node("docker") {
stage("Update version in Kubernetes") {
dir ("build") {
// Надо создать пачку кредов в Jenkins, а также пространство с кредами подключения в Vault
creds = ["auth", "certificate", "key", "k8scluster", "endpoint"]
creds.each { cred ->
withCredentials([vaultString(credentialsId: "${env.registryContainerName}-${cred}-${stand}", variable: "key")]) {
env."${cred}" = key
}
withCredentials([vaultString(credentialsId: "config.${env.registryContainerName}-${env.stand}", variable: "pem")]) {
sh """
set +x
echo "${pem}" | base64 -d > auth.config
set -x
"""
}
convertJinja("auth.config.tmpl", "auth.config")
convertJinja("microservice.yaml.tmpl", "microservice.yaml")
sh "kubectl --kubeconfig=auth.config get pods --namespace ${env.namespace}"