Commit 45385ac2 authored by kalvin's avatar kalvin

增加cluster参数,用于区分生产镜像和测试开发镜像

parent 3aefae0b
...@@ -222,7 +222,7 @@ def build_luaui(namespace, systemNames, contextDir) { ...@@ -222,7 +222,7 @@ def build_luaui(namespace, systemNames, contextDir) {
} }
} }
def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemName, contextDir) { def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemName, contextDir, cluster) {
regex = "[`,./;\\[\\]&<>?:\"()|-]+" regex = "[`,./;\\[\\]&<>?:\"()|-]+"
k8sSystemName = systemName.replaceAll("_","-") k8sSystemName = systemName.replaceAll("_","-")
...@@ -234,7 +234,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa ...@@ -234,7 +234,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa
withDockerServer([uri: "tcp://192.168.4.96:2375/"]) { withDockerServer([uri: "tcp://192.168.4.96:2375/"]) {
withDockerRegistry([credentialsId: 'harbor-qajenkins', url: "http://192.168.4.36"]) { withDockerRegistry([credentialsId: 'harbor-qajenkins', url: "http://192.168.4.36"]) {
def image = docker.build(imageTag, "--build-arg BUILD_TIME=${timeNow} --build-arg BUILD_NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${systemName} --build-arg BRANCH_NAME=${branchName} --build-arg SAFE_SYSTEM_NAME=${defaultSystemName} ${contextDir}") def image = docker.build(imageTag, "--build-arg CLUSTER=${cluster} --build-arg BUILD_TIME=${timeNow} --build-arg BUILD_NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${systemName} --build-arg BRANCH_NAME=${branchName} --build-arg SAFE_SYSTEM_NAME=${defaultSystemName} ${contextDir}")
image.push() image.push()
if (branchName == "master" || branchName == "master--master") { if (branchName == "master" || branchName == "master--master") {
......
...@@ -16,6 +16,7 @@ def call(body) { ...@@ -16,6 +16,7 @@ def call(body) {
def namespace = env.NAMESPACE def namespace = env.NAMESPACE
def isDeploy = env.IS_DEPLOY def isDeploy = env.IS_DEPLOY
def buildNumber = env.BUILD_NUMBER def buildNumber = env.BUILD_NUMBER
def cluster = env.CLUSTER
t = gitRepo.split("/") t = gitRepo.split("/")
def gitGroup = t[0] def gitGroup = t[0]
...@@ -110,7 +111,7 @@ def call(body) { ...@@ -110,7 +111,7 @@ def call(body) {
_stage.copy_files_java(systemName, contextDir) _stage.copy_files_java(systemName, contextDir)
} }
imageTag = _stage.dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemName, contextDir) imageTag = _stage.dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemName, contextDir, cluster)
} }
stage('Deploy To K8s Cluster') { stage('Deploy To K8s Cluster') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment