Commit 2af98940 authored by kalvin's avatar kalvin

Merge branch 'master' of git.quantgroup.cn:QA/global-jenkinsfile

parents 715cf42d 7fb612d2
...@@ -14,10 +14,12 @@ def sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath){ ...@@ -14,10 +14,12 @@ def sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath){
sonarScanner = "/home/quant_group/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar/bin/sonar-scanner" sonarScanner = "/home/quant_group/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar/bin/sonar-scanner"
currentPath = sh (script: 'pwd',returnStdout: true).trim() currentPath = sh (script: 'pwd',returnStdout: true).trim()
git branch: "${GIT_BRANCH}", credentialsId: 'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db', url: "${GIT_PEPO_SSH_URL}" /* git branch: "${GIT_BRANCH}", credentialsId: 'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db', url: "${GIT_PEPO_SSH_URL}"*/
git commit: "${GIT_BRANCH}", credentialsId: 'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db', url: "${GIT_REPO_SSH_URL}"
sh "${sonarScanner} -e \ sh "${sonarScanner} -e \
-Dsonar.host.url=http://172.30.3.42:9000 \ -Dsonar.host.url=http://sonar.q-gp.com \
-Dsonar.projectVersion=${GIT_BRANCH} \ -Dsonar.projectVersion=${GIT_BRANCH} \
-Dsonar.projectKey=${GIT_REPO_NAME} \ -Dsonar.projectKey=${GIT_REPO_NAME} \
-Dsonar.java.binaries=. \ -Dsonar.java.binaries=. \
...@@ -27,7 +29,7 @@ def sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath){ ...@@ -27,7 +29,7 @@ def sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath){
} }
def callback_pipes(taskId) { def callback_pipes(callbackHost ,taskId) {
sleep 3 sleep 3
sonarInfo = sh (script: 'cat .sonar/report-task.txt |awk \'{printf $0 "&"}\'',returnStdout: true).trim() sonarInfo = sh (script: 'cat .sonar/report-task.txt |awk \'{printf $0 "&"}\'',returnStdout: true).trim()
...@@ -47,13 +49,13 @@ def callback_pipes(taskId) { ...@@ -47,13 +49,13 @@ def callback_pipes(taskId) {
def bodyJson = JsonOutput.toJson(body) def bodyJson = JsonOutput.toJson(body)
echo bodyJson echo bodyJson
dest_url = "http://192.168.28.141:8080/callback/ci/triger"
response = httpRequest httpMode:"POST", response = httpRequest httpMode:"POST",
consoleLogResponseBody:true, consoleLogResponseBody:true,
contentType:"APPLICATION_JSON", contentType:"APPLICATION_JSON",
requestBody:"${bodyJson}", requestBody:"${bodyJson}",
url:dest_url url:callbackHost
/* def res_json = jsonParse(response.content) /* def res_json = jsonParse(response.content)
return res_json*/ return res_json*/
......
...@@ -82,7 +82,7 @@ def prepare_java(systemName, contextDir) { ...@@ -82,7 +82,7 @@ def prepare_java(systemName, contextDir) {
def prepare_nodejs(systemName, contextDir) { def prepare_nodejs(systemName, contextDir) {
sh "cp -rf /home/quant_group/qg-dockerfiles/templates/nodejs/* ${contextDir}" sh "cp -rf /home/quant_group/qg-dockerfiles/templates/nodejs/* ${contextDir}"
sh "cp -rf /home/quant_group/config_repository/lua-ui/config/${systemName}.js ${systemName}.env.config" sh "cp -rf /home/quant_group/config_repository/nodejs/${systemName}.js ${systemName}.env.config"
sh "cp -rf /home/quant_group/config_repository/lua-ui/npmrc/common-npmrc /root/.npmrc" sh "cp -rf /home/quant_group/config_repository/lua-ui/npmrc/common-npmrc /root/.npmrc"
...@@ -305,7 +305,7 @@ def build_nodejs( systemName, contextDir) { ...@@ -305,7 +305,7 @@ def build_nodejs( systemName, contextDir) {
buildCmd = projectAttr["buildCmd"] buildCmd = projectAttr["buildCmd"]
configName = systemName configName = systemName
sh "mv -f env.config ${configPath}" sh "mv -f ./${systemName}.env.config ${configPath}"
sh "tar zcf ${contextDir}/dist.tgz ./* " sh "tar zcf ${contextDir}/dist.tgz ./* "
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
def call(body) { def call(body) {
def timeStemp = new Date().format("yyyyMMddHHmmss") def timeStemp = new Date().format("yyyyMMddHHmmss")
def env = body.env def env = body.env
......
...@@ -2,41 +2,44 @@ def call(body) { ...@@ -2,41 +2,44 @@ def call(body) {
def _stage = new org.qg.ci.StageBucket() def _stage = new org.qg.ci.StageBucket()
def _utils = new org.qg.docker_new.Utils() def _utils = new org.qg.docker_new.Utils()
def env = body.env def env = body.env
def GIT_PEPO_SSH_URL = env.GIT_PEPO_SSH_URL def GIT_REPO_SSH_URL = env.GIT_REPO_SSH_URL
def GIT_REPO_NAME = env.GIT_REPO_NAME def GIT_REPO_NAME = env.GIT_REPO_NAME
def GIT_BRANCH = env.GIT_BRANCH def GIT_BRANCH = env.GIT_BRANCH
def GIT_BRANCH_HASH = env.GIT_BRANCH_HASH def GIT_BRANCH_HASH = env.GIT_BRANCH_HASH
def GIT_TRIGER_USER = env.GIT_TRIGER_USER def GIT_TRIGGER_USER = env.GIT_TRIGGER_USER
def TASK_INDEX = env.TASK_ID def TASK_INDEX = env.TASK_INDEX
def callbackHost
def config = [:]
def currentPath def currentPath
/*body.resolveStrategy = Closure.DELEGATE_FIRST body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config body.delegate = config
body()*/ body()
callbackHost = config.callbackHost
ansiColor('xterm') { ansiColor('xterm') {
echo "\033[32m############################################\n\ echo "\033[32m############################################\n\
# GIT_PEPO_SSH_URL:${GIT_PEPO_SSH_URL}\n\ # GIT_REPO_SSH_URL:${GIT_REPO_SSH_URL}\n\
# GIT_REPO_NAME:${GIT_REPO_NAME}\n\ # GIT_REPO_NAME:${GIT_REPO_NAME}\n\
# GIT_BRANCH:${GIT_BRANCH}\n\ # GIT_BRANCH:${GIT_BRANCH}\n\
# GIT_BRANCH_HASH:${GIT_BRANCH_HASH}\n\ # GIT_BRANCH_HASH:${GIT_BRANCH_HASH}\n\
# GIT_TRIGER_USER:${GIT_TRIGER_USER}\n\ # GIT_TRIGGER_USER:${GIT_TRIGGER_USER}\n\
############################################\033[0m" ############################################\033[0m"
} }
node{ node{
dir(GIT_REPO_NAME){ dir(GIT_REPO_NAME){
urrentPath = sh (script: 'pwd',returnStdout: true).trim() currentPath = sh (script: 'pwd',returnStdout: true).trim()
stage("SonarQube Quality Gate"){ stage("SonarQube Quality Gate"){
/* _stage.sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath)*/ _stage.sonaar_check(GIT_REPO_NAME,GIT_BRANCH_HASH,currentPath)
} }
stage("callback"){ stage("callback"){
_stage.callback_pipes(TASK_INDEX) _stage.callback_pipes(callbackHost,TASK_INDEX)
} }
} }
......
...@@ -80,7 +80,7 @@ def call(body) { ...@@ -80,7 +80,7 @@ def call(body) {
def regex = "[`,./;\\[\\]&<>?:\"()|-]+" def regex = "[`,./;\\[\\]&<>?:\"()|-]+"
def k8sSystemName = originSystemName.replaceAll("_","-") def k8sSystemName = originSystemName.replaceAll("_","-")
def safeBranchName = originBranchName.replaceAll(regex,"_") def safeBranchName = originBranchName.replaceAll(regex,"_")
imageTagInfos = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,branchHashCode) imageTagInfos = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp)
for (imageTagInfo in imageTagInfos){ for (imageTagInfo in imageTagInfos){
_stage.dockerbuild_and_push(imageTagInfo,buildNumber,_systemName,originBranchName ,cluster,timeStemp,contextDir,branchHashCode) _stage.dockerbuild_and_push(imageTagInfo,buildNumber,_systemName,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