This commit is contained in:
msyu
2025-02-04 13:29:48 +03:00
+7 -6
View File
@@ -14,14 +14,14 @@ node("docker") {
error("stand не соответствует 'prod', 'test' или 'dev'") error("stand не соответствует 'prod', 'test' или 'dev'")
} }
stage("Prepare environments") { stage("Prepare environments") {
envConfig = "build/vars/build.yaml" envConfig = "build/vars/build.yaml"
support.getVarsV2(envConfig) support.getVarsV2(envConfig)
// пока не будет готов отдельный dev стенд // пока не будет готов отдельный dev стенд
env.namespace = "${env.namespace}-${stand}" env.namespace = "${env.namespace}-${stand}"
env.registryContainerName = "${env.registryContainerName}-${stand}" env.registryContainerName = "${env.registryContainerName}-${stand}"
env.version = sh(script: "git rev-parse HEAD", returnStdout: true).trim()
println "Success prepare" println "Success prepare"
} }
@@ -38,13 +38,14 @@ node("docker") {
stage("Build image") { stage("Build image") {
println "Start building image ${env.registryContainerName}:${env.version}" println "Start building image ${env.registryContainerName}:${env.version}"
app = docker.build("${env.registryContainerName}:${env.version}", "--no-cache -f ./build/Dockerfile .") app = docker.build("${env.registryContainerName}:${env.version}", "--no-cache -f ./build/Dockerfile .")
println "Start uploading image ${env.registryContainerName}:${env.version} to Nexus" println "Start uploading image ${env.registryContainerName}:${env.version} to Nexus"
docker.withRegistry("https://${registryUrl}", "nexus-jenkins-cred") { docker.withRegistry("https://${registryUrl}", "nexus-jenkins-cred") {
app.push("${env.version}") app.push("${env.version}")
app.push("latest") app.push("latest")
} }
} }
stage("Update version in Kubernetes") { stage("Update version in Kubernetes") {
@@ -70,8 +71,8 @@ node("docker") {
sh "kubectl --kubeconfig=auth.config get pods --namespace ${env.namespace}" sh "kubectl --kubeconfig=auth.config get pods --namespace ${env.namespace}"
} }
} }
println "Success build job. Now start cleanup" println "Success build job. Now start cleanup"
cleanWs( cleanWs(
@@ -80,4 +81,4 @@ node("docker") {
) )
} }
} }
} }