Commit 78a1fb02 authored by tywldx's avatar tywldx
parents d3a46911 36e99251
...@@ -237,7 +237,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa ...@@ -237,7 +237,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa
def build_schema = "BUILD_TIME:${timeNow}@BUILD_NUMBER:${buildNumber}@SYSTEM_NAME:${systemName}@BRANCH_NAME:${branchName}" def build_schema = "BUILD_TIME:${timeNow}@BUILD_NUMBER:${buildNumber}@SYSTEM_NAME:${systemName}@BRANCH_NAME:${branchName}"
echo build_schema echo build_schema
def image = docker.build(imageTag, "--build-arg BUILD_SCHEMA=${build_schema} ${contextDir}") def image = docker.build(imageTag, "--build-arg SYSTEM_NAME=${systemName} --build-arg BUILD_SCHEMA=${build_schema} ${contextDir}")
image.push() image.push()
if (branchName == "master" || branchName == "master--master") { if (branchName == "master" || branchName == "master--master") {
......
This diff is collapsed.
...@@ -40,6 +40,7 @@ def call(body) { ...@@ -40,6 +40,7 @@ def call(body) {
try { try {
echo config.buildType echo config.buildType
/* 1 */
stage('prepare') { stage('prepare') {
_utils.beautyEcho("Prepare", "stage") _utils.beautyEcho("Prepare", "stage")
contextDir = _stage.contextMkdir("${systemName}-${timeStemp}") contextDir = _stage.contextMkdir("${systemName}-${timeStemp}")
...@@ -47,57 +48,35 @@ def call(body) { ...@@ -47,57 +48,35 @@ def call(body) {
} }
/* 2 */
withDockerServer([uri: "tcp://192.168.4.96:2375/"]) { withDockerServer([uri: "tcp://192.168.4.96:2375/"]) {
stage('checkout & build') { stage('checkout & build') {
_utils.beautyEcho("checkout & build", "stage") _utils.beautyEcho("checkout & build", "stage")
def pacegeDockerInfo = _stage.getDocketPackageImage(config.buildType)
arrSystem = systemName.split("--")
docker.image(pacegeDockerInfo["image"]).inside(pacegeDockerInfo["args"]){ for (systemNameSimple in arrSystem) {
_stage.checkAndBuild(config.buildType, systemNameSimple, branchName, contextDir)
def project_attr = _stage.project_attr(systemName)
def gitPath = project_attr["gitPath"]
/*checkout code*/
_utils.beautyEcho("checkout", "info")
_stage.checkout(config.buildType, systemName, branchName)
/*prepare config*/
_utils.beautyEcho("prepare config", "info")
_stage.prepare_config(config.buildType, systemName, contextDir)
/*build*/
_utils.beautyEcho("build", "info")
_stage.build(config.buildType, systemName, contextDir)
} }
_utils.beautyEcho("build over", "info")
} }
_utils.beautyEcho("build over", "info") }
/* 3 */
withDockerServer([uri: "tcp://192.168.4.96:2375/"]) {
stage('make docker image') { stage('make docker image') {
_utils.beautyEcho("make docker image", "stage") _utils.beautyEcho("make docker image", "stage")
imageTag = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp) imageTag = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp)
_stage.dockerMake(imageTag,buildNumber,systemName,branchName,cluster,timeStemp)
withDockerRegistry([credentialsId: 'harbor-qajenkins', url: "http://192.168.4.36"]) {
def build_schema = "BUILD_TIME:${timeStemp}@BUILD_NUMBER:${buildNumber}@SYSTEM_NAME:${systemName}@BRANCH_NAME:${branchName}@CLUSTER:${cluster}"
echo build_schema
def image = docker.build(imageTag, "--build-arg BUILD_SCHEMA=${build_schema} ${contextDir}")
image.push()
if (branchName == "master" || branchName == "master--master") {
image.push('latest')
}
}
} }
stage('Deploy To K8s Cluster'){ stage('Deploy To K8s Cluster'){
_utils.beautyEcho("Deploy To K8s Cluster", "stage") _utils.beautyEcho("Deploy To K8s Cluster", "stage")
_utils.beautyEcho("Deploy image: ${imageTag} to:${namespace}", "info")
_stage.deploy(namespace, systemName, imageTag, config.tier, isDeploy) _stage.deploy(namespace, systemName, imageTag, config.tier, isDeploy)
} }
...@@ -108,11 +87,11 @@ def call(body) { ...@@ -108,11 +87,11 @@ def call(body) {
}catch (err) { }catch (err) {
_utils.beautyEcho(err, "fail") _utils.beautyEcho(err, "fail")
/* sh "rm -rf ${contextDir}"*/ sh "rm -rf ${contextDir}"
if (imageTag){ if (imageTag){
_stage.clean_images(imageTag) _stage.clean_images(imageTag)
} }
sleep 120
throw err throw err
...@@ -121,3 +100,6 @@ def call(body) { ...@@ -121,3 +100,6 @@ def call(body) {
} }
} }
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