Commit 25ecbb0f authored by 智勇's avatar 智勇

up

parent fe172d5f
...@@ -18,12 +18,12 @@ def contextMkdir(key) { ...@@ -18,12 +18,12 @@ def contextMkdir(key) {
return contextDir return contextDir
} }
def imageTag(harborGroup,k8sSystemName,safeBranchName,tagName,imageType){ def imageTag(harborGroup,k8sSystemName,safeBranchName,tagName){
def imageTag4_4=[:] def imageTag4_4=[:]
imageTag4_4["harborHost"]="http://192.168.4.4" imageTag4_4["harborHost"]="http://192.168.4.4"
imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tke${safeBranchName}-${tagName}" imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tke${safeBranchName}-${tagName}"
imageTag4_4["imageTagCode"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tkeCode${safeBranchName}-${tagName}" imageTag4_4["imageTagCode"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tkeCode${safeBranchName}-${tagName}"
// if(imageType=="test"){ // if=="test"){
// imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tke${safeBranchName}-${tagName}" // imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tke${safeBranchName}-${tagName}"
// }else{ // }else{
// imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tkeCode${safeBranchName}-${tagName}" // imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:tkeCode${safeBranchName}-${tagName}"
...@@ -184,7 +184,7 @@ def getDocketPackageImage(buildType,buildEnv){ ...@@ -184,7 +184,7 @@ def getDocketPackageImage(buildType,buildEnv){
return packageImageInfo return packageImageInfo
} }
def check_and_build(buildType,systemName,branchName,contextDir,imageType){ def check_and_build(buildType,systemName,branchName,contextDir){
def branchHashCode = null def branchHashCode = null
...@@ -209,17 +209,17 @@ def check_and_build(buildType,systemName,branchName,contextDir,imageType){ ...@@ -209,17 +209,17 @@ def check_and_build(buildType,systemName,branchName,contextDir,imageType){
def pacegeDockerInfo = getDocketPackageImage(buildType,buildEnv) def pacegeDockerInfo = getDocketPackageImage(buildType,buildEnv)
if (buildType in ["nodejs","lua-ui"]){ if (buildType in ["nodejs","lua-ui"]){
branchHashCode = cpb(buildType,systemName,branchName,contextDir,imageType) branchHashCode = cpb(buildType,systemName,branchName,contextDir)
} else { } else {
docker.image(pacegeDockerInfo["image"]).inside(pacegeDockerInfo["args"]){ docker.image(pacegeDockerInfo["image"]).inside(pacegeDockerInfo["args"]){
branchHashCode = cpb(buildType,systemName,branchName,contextDir,imageType) branchHashCode = cpb(buildType,systemName,branchName,contextDir)
} }
} }
return branchHashCode return branchHashCode
} }
def cpb(buildType,systemName,branchName,contextDir,imageType){ def cpb(buildType,systemName,branchName,contextDir){
/*checkout code*/ /*checkout code*/
stage('Checkout') { stage('Checkout') {
...@@ -230,7 +230,7 @@ def cpb(buildType,systemName,branchName,contextDir,imageType){ ...@@ -230,7 +230,7 @@ def cpb(buildType,systemName,branchName,contextDir,imageType){
if(systemName=='xjd-ui' && branchName == 'apollo'){ if(systemName=='xjd-ui' && branchName == 'apollo'){
_utils().beautyEcho("xjd-ui : apollo not exec prepare_config", "info") _utils().beautyEcho("xjd-ui : apollo not exec prepare_config", "info")
} else{ } else{
prepare_config(buildType, systemName, contextDir,imageType) prepare_config(buildType, systemName, contextDir)
} }
} }
...@@ -382,20 +382,20 @@ def checkout_luaui(systemName, branchName) { ...@@ -382,20 +382,20 @@ def checkout_luaui(systemName, branchName) {
} }
} }
def prepare_config(buildType,systemName, contextDir,imageType) { def prepare_config(buildType,systemName, contextDir) {
_utils().beautyEcho("Prepare Config +++ type:${buildType} systemName:${systemName}", "info") _utils().beautyEcho("Prepare Config +++ type:${buildType} systemName:${systemName}", "info")
switch (buildType) { switch (buildType) {
case "java": case "java":
prepare_java(systemName, contextDir,imageType) prepare_java(systemName, contextDir)
break break
case "nodejs": case "nodejs":
prepare_nodejs(systemName, contextDir,imageType) prepare_nodejs(systemName, contextDir)
break break
case "python": case "python":
prepare_python(systemName, contextDir,imageType) prepare_python(systemName, contextDir)
break break
case "lua-ui": case "lua-ui":
prepare_luaui(systemName, contextDir,imageType) prepare_luaui(systemName, contextDir)
break break
default: default:
_utils().beautyEcho("未知的buildType: ${buildType}","fail") _utils().beautyEcho("未知的buildType: ${buildType}","fail")
...@@ -403,12 +403,8 @@ def prepare_config(buildType,systemName, contextDir,imageType) { ...@@ -403,12 +403,8 @@ def prepare_config(buildType,systemName, contextDir,imageType) {
} }
} }
def prepare_java(systemName, contextDir,imageType) { def prepare_java(systemName, contextDir) {
if (imageType=="test") { sh "cp -rf /home/quant_group/qg-dockerfiles/tke/java/* ${contextDir}"
sh "cp -rf /home/quant_group/qg-dockerfiles/tke/java/* ${contextDir}"
}else{
sh "cp -rf /home/quant_group/qg-dockerfiles/prod/java/* ${contextDir}"
}
def existProperties = fileExists "/home/quant_group/config_repository/java/${systemName}.properties" def existProperties = fileExists "/home/quant_group/config_repository/java/${systemName}.properties"
......
...@@ -62,7 +62,7 @@ def call(body) { ...@@ -62,7 +62,7 @@ def call(body) {
_utils.beautyEcho("checkout & build < ${originSystemName} : ${originBranchName} >", "stage") _utils.beautyEcho("checkout & build < ${originSystemName} : ${originBranchName} >", "stage")
for(def i = 0; i<systemNames.length; i++){ for(def i = 0; i<systemNames.length; i++){
dir(systemNames[i]){ dir(systemNames[i]){
branchHashCode = _stage.check_and_build(config.buildType, systemNames[i], branchNames[i], contextDir, imageType) branchHashCode = _stage.check_and_build(config.buildType, systemNames[i], branchNames[i], contextDir)
} }
} }
_utils.beautyEcho("build over", "info") _utils.beautyEcho("build over", "info")
...@@ -76,7 +76,7 @@ def call(body) { ...@@ -76,7 +76,7 @@ def call(body) {
def k8sSystemName = originSystemName.replaceAll("_","-").toLowerCase() def k8sSystemName = originSystemName.replaceAll("_","-").toLowerCase()
def safeBranchName = originBranchName.replaceAll(regex,"_").toLowerCase() def safeBranchName = originBranchName.replaceAll(regex,"_").toLowerCase()
imageTagInfos = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp,imageType) imageTagInfos = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp)
for (imageTagInfo in imageTagInfos){ for (imageTagInfo in imageTagInfos){
_stage.dockerbuild_and_push(imageTagInfo,buildNumber,originSystemName,originBranchName ,cluster,timeStemp,contextDir,branchHashCode) _stage.dockerbuild_and_push(imageTagInfo,buildNumber,originSystemName,originBranchName ,cluster,timeStemp,contextDir,branchHashCode)
......
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