Commit 08533aa3 authored by wentao.suo's avatar wentao.suo

fix

parent 85982c36
......@@ -18,12 +18,12 @@ def contextMkdir(key) {
return contextDir
}
def imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp){
def imageTag(harborGroup,k8sSystemName,safeBranchName,tagName){
def imageTag4_4=[:]
/* def branchHash = sh (script: 'git log -1 --pretty=%H',returnStdout: true).trim()*/
imageTag4_4["harborHost"]="http://192.168.4.4"
imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:${safeBranchName}-${timeStemp}"
imageTag4_4["imageTag"] = "192.168.4.4/${harborGroup}/${k8sSystemName}:${safeBranchName}-${tagName}"
return [ imageTag4_4 ]
}
......@@ -114,6 +114,11 @@ def checkout(buildType,systemName, branchName) {
echo "未知的buildType: ${cbuildType}"
break
}
def brahHashCode = sh (script: 'git log -1 --pretty=%H',returnStdout: true).trim()
return brahHashCode
}
def checkout_java(systemName, branchName) {
......@@ -407,7 +412,7 @@ def getDocketPackageImage(buildType,buildEnv){
def check_and_build(buildType,systemName,branchName,contextDir){
def branchHashCode = null
def buildEnv =""
switch(buildType){
......@@ -432,20 +437,23 @@ def check_and_build(buildType,systemName,branchName,contextDir){
if (buildType in ["nodejs","lua-ui"]){
cpb(buildType,systemName,branchName,contextDir)
return
branchHashCode = cpb(buildType,systemName,branchName,contextDir)
} else {
docker.image(pacegeDockerInfo["image"]).inside(pacegeDockerInfo["args"]){
cpb(buildType,systemName,branchName,contextDir)
branchHashCode = cpb(buildType,systemName,branchName,contextDir)
}
}
return branchHashCode
}
def cpb(buildType,systemName,branchName,contextDir){
/*checkout code*/
stage('Checkout') {
checkout(buildType, systemName, branchName)
branchHashCode = checkout(buildType, systemName, branchName)
}
/*prepare config*/
stage('Prepare') {
......@@ -456,6 +464,8 @@ def cpb(buildType,systemName,branchName,contextDir){
build(buildType, systemName, contextDir)
}
return branchHashCode
}
def dockerbuild_and_push(imageTagInfo,buildNumber,systemName,branchName,cluster,timeStemp,contextDir){
......
......@@ -31,6 +31,7 @@ def call(body) {
def contextDir
def imageTagInfos
def branchHashCode
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
......@@ -59,7 +60,7 @@ def call(body) {
for(def i = 0; i<systemNames.length; i++){
dir(systemNames[i]){
_stage.check_and_build(config.buildType, systemNames[i], branchNames[i], contextDir)
branchHashCode = _stage.check_and_build(config.buildType, systemNames[i], branchNames[i], contextDir)
}
}
......@@ -77,7 +78,7 @@ def call(body) {
def regex = "[`,./;\\[\\]&<>?:\"()|-]+"
def k8sSystemName = originSystemName.replaceAll("_","-")
def safeBranchName = originBranchName.replaceAll(regex,"_")
imageTagInfos = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp)
imageTagInfos = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,branchHashCode)
for (imageTagInfo in imageTagInfos){
......
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