Commit 2352b148 authored by daidekun's avatar daidekun

debug

parent a56f5199
...@@ -3,6 +3,14 @@ package org.qg.docker; ...@@ -3,6 +3,14 @@ package org.qg.docker;
import org.qg.docker.Utils; import org.qg.docker.Utils;
import groovy.json.JsonSlurperClassic; import groovy.json.JsonSlurperClassic;
def debug() {
echo project_attr("pinjamancepat-credit-review-ui")
configPath = res_json["configPath"]
buildCmd = res_json["buildCmd"]
echo configPath
echo buildCmd
}
def before_prepare(contextDir) { def before_prepare(contextDir) {
sh "rm -rf ${contextDir}" sh "rm -rf ${contextDir}"
sh "cd /home/quant_group/qg-dockerfiles; git pull; cd -" sh "cd /home/quant_group/qg-dockerfiles; git pull; cd -"
...@@ -51,7 +59,7 @@ def checkout(branchName, gitRepo) { ...@@ -51,7 +59,7 @@ def checkout(branchName, gitRepo) {
} }
} }
def checkoutLuaUI(branchName, gitRepo) { def checkout_lua_ui(branchName, gitRepo) {
if(gitRepo.contains("--")){ if(gitRepo.contains("--")){
t1 = gitRepo.split("/") t1 = gitRepo.split("/")
groups = t1[0].split("--") groups = t1[0].split("--")
...@@ -105,11 +113,6 @@ def copy_files_java(systemName, contextDir) { ...@@ -105,11 +113,6 @@ def copy_files_java(systemName, contextDir) {
sh "cp ${jar_path} ${contextDir}/" sh "cp ${jar_path} ${contextDir}/"
} }
@NonCPS
def jsonParse(def json) {
new groovy.json.JsonSlurperClassic().parseText(json)
}
def build_nodejs(namespace, systemName, contextDir) { def build_nodejs(namespace, systemName, contextDir) {
response = httpRequest "http://192.168.4.3:10088/config_server/get_node_command/${systemName}" response = httpRequest "http://192.168.4.3:10088/config_server/get_node_command/${systemName}"
...@@ -222,3 +225,14 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) { ...@@ -222,3 +225,14 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) {
def clean_images(imageTag) { def clean_images(imageTag) {
sh "docker rmi -f \$(docker images -q ${imageTag})" sh "docker rmi -f \$(docker images -q ${imageTag})"
} }
@NonCPS
def jsonParse(def json) {
new groovy.json.JsonSlurperClassic().parseText(json)
}
def project_attr(systemName) {
response = httpRequest "http://192.168.4.3:10088/config_server/get_project_attr/${systemName}"
def res_json = jsonParse(response.content)
return res_json
}
\ No newline at end of file
import org.qg.docker.*
def call(body) {
def config = [:]
def env = body.env
def branchName = env.BRANCH_NAME
def gitRepo = env.GIT_REPO
def namespace = env.NAMESPACE
def isDeploy = env.IS_DEPLOY
def buildNumber = env.BUILD_NUMBER
t = gitRepo.split("/")
def gitGroup = t[0]
def originSystemName = t[1]
def systemName = originSystemName.toLowerCase()
def harborGroup = "library"
def workspace = "/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def imageTag
def contextDir
def _stage = new org.qg.docker.StageBucket()
def _utils = new org.qg.docker.Utils()
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
body()
node {
try {
dir (systemName) {
timestamps {
stage('Debug') {
_stage.debug()
}
}
}
} catch (err) {
if (imageTag) {
_stage.clean_images(imageTag)
}
currentBuild.result = 'FAILED'
throw err
}
}
}
\ No newline at end of file
...@@ -40,7 +40,7 @@ def call(body) { ...@@ -40,7 +40,7 @@ def call(body) {
_utils.beautyEcho(2, 'Checkout') _utils.beautyEcho(2, 'Checkout')
switch (config.buildType) { switch (config.buildType) {
case "lua-ui": case "lua-ui":
_stage.checkoutLuaUI(branchName, gitRepo) _stage.checkout_lua_ui(branchName, gitRepo)
break break
default: default:
_stage.checkout(branchName, gitRepo) _stage.checkout(branchName, gitRepo)
......
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