首页 技术 正文
技术 2022年11月19日
0 收藏 684 点赞 2,224 浏览 22071 个字
def pipeId = 1130561944231279390def pipeLogIddef isTagOrBranchdef tagOrBranchdef imageIddef addPipelineLog() {    def isUserTriggered = currentBuild.rawBuild.getCause(hudson.model.Cause$UserIdCause) != null    def isGitLabWebHookTriggered = currentBuild.rawBuild.getCause(com.dabsquared.gitlabjenkins.cause.GitLabWebHookCause) != null    def isTimerTriggered = currentBuild.rawBuild.getCause(hudson.triggers.TimerTrigger$TimerTriggerCause) != null    def isUpstreamTriggered = currentBuild.rawBuild.getCause(hudson.model.Cause.UpstreamCause) != null    println "trigger type:"+currentBuild.rawBuild.getCauses().dump()    println "params.logId: "+params.logId    println "params.projectVersionConfigId: "+params.projectVersionConfigId    println "params.publishLogId: "+params.publishLogId    println "params.preExecuteEndPipeStageId: "+params.preExecuteEndPipeStageId    def reqPipeLogId = params.logId    def command = $/curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc' -d '{"pipeId":1130561944231279390,"pipeLogId":"$reqPipeLogId","isUserTriggered":$isUserTriggered,"isGitLabWebHookTriggered":$isGitLabWebHookTriggered,"isTimerTriggered":$isTimerTriggered,"isUpstreamTriggered":$isUpstreamTriggered}' "http://10.145.196.76:12000/pipeline/pipelines/pipelineLog" /$    res = sh(returnStdout: true, script: command).trim()    println "add pipeline log result:\n" + res    return parseJsonText(res).body.content}def getStageLog(log) {    def stageLog = log.substring(log.lastIndexOf("[Pipeline] stage"))    echo "log size:" + stageLog.length()    return URLEncoder.encode(stageLog, "UTF-8")}def toUpdatePipelineLogCurlSh(result, duration, log, pipeLogId, pipeStageId) {    def tmpDir = 'deploy_tmp'    def tmpFile = 'updatePipelineLog_params_tmp'    def data = '{"flag":"'+result+'","duration":"'+duration+'","message":"'+log+'","pipeLogId":"'+pipeLogId+'","pipeStageId":"'+pipeStageId+'","preExecuteEndPipeStageId":"'+preExecuteEndPipeStageId+'"}';    writeToFile(env.WORKSPACE, tmpDir, tmpFile, data)    def tmpFilePath = tmpDir + '/' + tmpFile    def curl = 'curl -X PUT  --header \'Content-Type: application/json\' --header \'Accept: application/json\' --header \'token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc\' --data-binary "@'+ tmpFilePath +'" "http://10.145.196.76:12000/pipeline/pipelines/pipelineStageLog" '    return curl}def toEndPipelineLogCurlSh(result, pipeLogId, projectVersionConfigId, publishLogId) {    def curl = 'curl -X GET  --header \'token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc\' "http://10.145.196.76:12000/pipeline/pipelines/pipeLineLog/'+pipeLogId+'?flag='+result+'&projectVersionConfigId='+projectVersionConfigId+'&publishLogId='+publishLogId+'" '    return curl}//预执行结束阶段校验def preExecuteEndPipelineStageCheck(pipeStageId) {    def pipeStageIdStr = '' + pipeStageId    def isEndPoint = (params.preExecuteEndPipeStageId != null && pipeStageIdStr == params.preExecuteEndPipeStageId)    if (isEndPoint) {        println "this stage is pre-execute end stage, pre-execute finished "        error "preExecuteFinished"    }}//若异常是预执行结束,将result置为SUCCESSdef setPreExecuteResult(result, msg) {    if (msg == 'preExecuteFinished') {        result = 'SUCCESS'        println "this exception message is pre-execute finished , set result to SUCCESS "        println "本阶段是预执行结束阶段,预执行完成"        cleanWs()        println "clean workspace"    }    return result}//sonar check analysisdef toSonarCheckCurlSh(appId, appKey) {    def curl = 'curl -X POST --header \'token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc\' -d \'appId='+appId+'&appKey='+appKey+'\' "http://10.145.196.76:12000/quality/analysis" '    return curl}def analysisSonarCheck(appId, appKey) {    def data = '?appId='+appId+'&appKey='+appKey    def url = 'http://10.145.196.76:12000/quality/analysis'+data    println "request " + url + " to analysis sonar check result \nparams: " + data    return paasPost(url, null)}def getSonarAppProfile(appId) {    /*    // GET    def get = new URL("http://10.145.196.76:12000/quality/app/profile/"+appId).openConnection();    get.setRequestProperty("token","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc")    def getRC = get.getResponseCode();    def res;    if(getRC.equals(200)) {        res=get.getInputStream().getText()        println(res);    } else {        error "Sonar Check Stage - getSonarAppProfile(" + appId + ") get sonar app profile error :" + getRC    }    return parseJsonText(res).body.content    */    def url = 'http://10.145.196.76:12000/quality/app/profile/'+appId    println "request " + url + " to get sonar app profile"    return paasGet(url)}def toApproveCurlSh(pipeId, pipeLogId, pipeStageId, buildId, jobName) {    def curl = 'curl -X POST --header \'Content-Type: application/json\' --header \'Accept: application/json\' --header \'token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc\' -d \'{"pipeId":"'+pipeId+'","pipeLogId":"'+pipeLogId+'","pipeStageId":"'+pipeStageId+'","inputId":"'+pipeStageId+'","buildId":"'+buildId+'","jobName":"'+jobName+'"}\' "http://10.145.196.76:12000/pipeline/pipelines/addPersonalTask" '    return curl}//sync harbor image by our apidef syncPaasImage(imageId, targetCeEnv, pipeLogId, pipeStageId) {    def url = 'http://10.145.196.76:12000/pipeline/image/sync'    def data = '{"imageId":"'+imageId+'","targetCeEnv":"'+targetCeEnv+'","pipeLogId":"'+pipeLogId+'","pipeStageId":"'+pipeStageId+'"}'    println "request " + url + " to sync harbor image by pipeline's api\nparams: " + data    return paasPost(url, data)}//sync harbor image by ce-api directlydef syncPaasImage(url, sourceAddress, destAddress, codePackagePath, imageName, pipeLogId) {    if (imageName == null || imageName == '' || imageName == 'null') {        //适用于构建镜像阶段(选择镜像阶段不需要,yaml中已有镜像名)        imageName = getImageName(codePackagePath, pipeLogId)    }    sourceAddress = sourceAddress+':'+imageName    destAddress = destAddress+':'+imageName    def data = '{"pullpoint":"'+sourceAddress+'","pushpoint":"'+destAddress+'"}'    println "request " + url + " to sync harbor image by ce-api directly\nparams: " + data    return paasPost(url, data)}//record sync-image infodef recordSyncImageInfo(imageId, ceEnvKey, pipeLogId, pipeStageId) {    def url = 'http://10.145.196.76:12000/pipeline/image/syncImage'    def data = '{"imageId":"'+imageId+'", "imageCeEnv":"'+ceEnvKey+'",' +        '"pipeStageId":"'+pipeStageId+'", "pipeLogId":"'+pipeLogId+'"}'    println "request " + url + " to save sync-image info\nparams: " + data    return paasPost(url, data)}//build harbor imagedef buildPaasImage(ceRemoteAddress, imgNamespaceName, repoName,    tagName, codeFilePath, hasAdditionalFile, curlUploadFilePara,    dockerFileType, dockerfilePath, dockerFileContent) {    //upload files    uploadImageFiles(codeFilePath, hasAdditionalFile, curlUploadFilePara,        ceRemoteAddress, imgNamespaceName, repoName, tagName);    //dockerfile    dockerfile = getDockerfileContent(dockerFileType, dockerfilePath, dockerFileContent)    //build image    buildPaasImage(dockerfile,        ceRemoteAddress, imgNamespaceName, repoName, tagName);    //wait image build finished    waitImageBuildFinished(ceRemoteAddress, imgNamespaceName, repoName, tagName);}//record image infodef recordImageInfo(ceEnvKey, imgNamespaceName, repoName, tagName,    isTagOrBranch, tagOrBranch, pipeLogId, pipeStageId) {    def url = 'http://10.145.196.76:12000/pipeline/image'    def data = '{"imageCeEnv":"'+ceEnvKey+'", "imageNamespace":"'+imgNamespaceName+'", "imageRepo":"'+repoName+'", "imageName":"'+tagName+'",' +        '"sourceCodeType":"'+isTagOrBranch+'", "sourceCode":"'+tagOrBranch+'",' +        '"appId":"123", "baseId":"1107175323881272818", "pipeId":"1130561944231279390", "pipeStageId":"'+pipeStageId+'",' +        '"pipeLogId":"'+pipeLogId+'"}'    println "request " + url + " to save image info\nparams: " + data    return paasPost(url, data)}def uploadImageFiles(codeFilePath, hasAdditionalFile, curlUploadFilePara,    ceRemoteAddress, imgNamespaceName, repoName, tagName) {    def otherFilePara = ""    if (hasAdditionalFile) {        otherFilePara = curlUploadFilePara    }    def uploadCommand = '''        #上传构建镜像所需文件        curl -F "files=@'''+codeFilePath+'''" '''+otherFilePara+''' --header "token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc" "'''+ceRemoteAddress+'''/zuul/ceimage/uploadfiles?namespace-name='''+imgNamespaceName+'''&repo-name='''+repoName+'''&tag-name='''+tagName+'''&username=temscmt"    '''    def uploadRes = sh(returnStdout: true, script: uploadCommand).trim()    println "upload image related files to paas container result:\n " + uploadRes    handleException(uploadRes, 'upload image related files to paas container')}def getDockerfileContent(dockerFileType, dockerfilePath, dockerFileContent) {    def tmpDir = 'deploy_tmp'    //dockerfile内容输出到文件    if (dockerFileType == 'INPUT') {        def tmpFile = 'Dockerfile_devops_tmp'        println "dockerfile content is by user input online, so need to write to a tmp file"        writeToFile(env.WORKSPACE, tmpDir, tmpFile, dockerFileContent)        dockerfilePath = tmpDir + '/' + tmpFile    }    dockerfile = readFile encoding: 'UTF-8', file: dockerfilePath    dockerfile = dockerfile.replaceAll("\n", "\\\\n")    return dockerfile}def writeToFile(currentPath, relativeDirPath, filename, content) {    println "write to file " + currentPath + " " + relativeDirPath + " " +filename    writeFile encoding: 'UTF-8', file: relativeDirPath+'/'+filename, text: content    println "write to file finish"}def buildPaasImage(dockerfile,    ceRemoteAddress, imgNamespaceName, repoName, tagName) {    def baseImageName='centos-jdk8'    def baseImageTag='latest'    def url = ceRemoteAddress + '/ceimage/build'    def data = '{"baseImageName": "'+baseImageName+'","baseImageTag": "'+baseImageTag+'", "dockerfile": "'+dockerfile+'", "namespaceName": "'+imgNamespaceName+'", "repoName": "'+repoName+'", "tag": "'+tagName+'", "username":"temscmt"}'    println "request " + url + " to build image\nparams: " + data    paasPost(url, data)    /*    def buildCommand = '''        #构建镜像        curl -X POST --header 'Content-Type: application/json' \        --header 'Accept: application/json' \        --header "token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc" \        -d '{"baseImageName": "'''+baseImageName+'''","baseImageTag": "'''+baseImageTag+'''", "dockerfile": "'''+dockerfile+'''", "namespaceName": "'''+imgNamespaceName+'''", "repoName": "'''+repoName+'''", "tag": "'''+tagName+'''", "username":"temscmt"}' \        "'''+ceRemoteAddress+'''/ceimage/build"    '''    def buildRes = sh(returnStdout: true, script: buildCommand).trim()    handleException(buildRes, 'build image to paas container error')    */}def waitImageBuildFinished(ceRemoteAddress, imgNamespaceName, repoName, tagName) {    timeout(10) {        waitUntil {            def res = getCeImageBuildDetail(ceRemoteAddress, imgNamespaceName, repoName, tagName)            if (res == null) {                println " image build detail body null 镜像还未找到... "                return false            } else if (res.status == '1') {                println " image build detail status 1 镜像构建中 ... "                return false            } else if (res.status == '2') {                println " image build detail status 2 镜像构建成功 ... "                return true            } else if (res.status == '3') {                println " image build detail status 3 镜像构建失败 ... "                error "镜像构建失败"            } else {                println " image build detail status other ... " + res.status                return false            }        }    }}def getCeImageBuildDetail(ceRemoteAddress, imgNamespaceName, repoName, tagName) {    def url = ceRemoteAddress + '/ceimage/buildrecords/namespaces/' + imgNamespaceName + '/repos/' + repoName + '/tags/' + tagName    println "request " + url + " to get image build detail"    return paasGet(url)}//select harbor imagedef selectPaasImage(ceRemoteAddress, imgNamespaceName, repoName, tagName) {    def res = getCeImageBuildDetail(ceRemoteAddress, imgNamespaceName, repoName, tagName)    if (res != null && res.status == '2') {        println " 镜像存在"    } else {        println " image status other ... " + res.status        error "镜像状态异常"    }}//ansible deploydef ansibleDeploy() {    def url = 'http://10.145.196.76:12000/pipeline/pipelines/get/stage/config?pipeId=1130561944231279390'    println "request " + url + " to get ansible inventory and playbook"    def res = paasGet(url)    def inventory = res.inventory    //println "res.inventory:\n" + inventory    def playbook = res.playbook    println "res.playbook:\n" + playbook    def tmpDir = 'deploy_tmp';    println "inventory content is by user input online, so need to write to a tmp file"    writeToFile(env.WORKSPACE, tmpDir, 'inventory_tmp', inventory)    println "playbook content is by user input online, so need to write to a tmp file"    writeToFile(env.WORKSPACE, tmpDir, 'playbook_tmp.yml', playbook)}//deploy paas appdef deployPaasApp(pipeStageId, codePackagePath, pipeLogId) {    def codeFileNoExt = ''    if (codePackagePath != null && codePackagePath != '' && codePackagePath != 'null') {        //适用于构建镜像阶段(选择镜像阶段不需要,yaml中已有镜像名)        codeFileNoExt = getCodeFileNameNoExt(codePackagePath)    }    def url = 'http://10.145.196.76:12000/pipeline/pipelines/paasdeploy'    def data = '{"pipeId":"1130561944231279390","pipeStageId":"'+pipeStageId+'","parameters":{"codeFileNoExt":"'+codeFileNoExt+'","buildId":"'+env.BUILD_ID+'","pipeLogId":"'+pipeLogId+'"}}'    println "request " + url + " to deploy paas app\nparams: " + data    return paasPost(url, data)    /*    def command = '''        #容器应用发布        curl -X POST --header 'Content-Type: application/json' \        --header 'Accept: application/json' \        --header "token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc" \        -d '{"pipeId": "1130561944231279390","pipeStageId": "'''+pipeStageId+'''", "parameters": {"codeFileNoExt":"'''+codeFileNoExt+'''", "buildId": "'''+env.BUILD_ID+'''", "pipeLogId": "'''+pipeLogId+'''"}}' \        "http://10.145.196.76:12000/pipeline/pipelines/paasdeploy"    '''    def res = sh(returnStdout: true, script: command).trim()    handleException(res, 'deploy app to paas container error')    */}//get image name by code package's fuzzy path user inputdef getImageName(codePackagePath, pipeLogId) {    codeFileNoExt = getCodeFileNameNoExt(codePackagePath)    return formatImageName(codeFileNoExt, pipeLogId)}//get image name by code package's exact relative pathdef getImageNameByExactPath(codeFilePath, pipeLogId) {    codeFileNoExt = getCodeFileNameNoExtByExactPath(codeFilePath)    return formatImageName(codeFileNoExt, pipeLogId)}//format image namedef formatImageName(codeFileNoExt, pipeLogId) {    return codeFileNoExt + '-te-msc-paas-gateway-' + pipeLogId + '-' + env.BUILD_ID}//get code package filename without extension by fuzzy path user inputdef getCodeFileNameNoExt(codePackagePath) {    def codeFilePath = getCodeFilePath(codePackagePath)    return getCodeFileNameNoExtByExactPath(codeFilePath)}//get code package filename without extension by its exact relative pathdef getCodeFileNameNoExtByExactPath(codeFilePath) {    def command = '''        #获取包名        codeFile=$(basename '''+codeFilePath+''')        #获取不含后缀的包名        echo ${codeFile%.*}    '''    return sh(returnStdout: true, script: command).trim()}//find code package and return relative path by fuzzy path user inputdef getCodeFilePath(codePackagePath) {    def command = '''        #获取包文件        codePackageSearchName=$(basename "'''+codePackagePath+'''")        codePackageDirname=$(dirname "'''+codePackagePath+'''")        codeFile=$(find $codePackageDirname -name $codePackageSearchName)        #若模糊匹配的文件有多个,只取第一个        echo $codeFile | awk '{ print $1 }'    '''    return sh(returnStdout: true, script: command).trim()}// PAAS GETdef paasGet(url) {    def req = new URL(url).openConnection();    req.setRequestProperty("token","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc")    def getRC = req.getResponseCode()    println "response code:"+getRC    def res;    if(getRC.equals(200)) {        res=req.getInputStream().getText()        def code = parseJsonText(res).code        println "response paas json code:"+code        if (code != '000000') {            error "ERROR: request " + url + " " + code +  " error.\n" + res        }        println("result:\n" + res)    } else {        println "ERROR: request " + url + " " + getRC + " error."        error req.getInputStream().getText()    }    return parseJsonText(res).body.content}// PAAS POSTdef paasPost(url, data) {    def req = new URL(url).openConnection()    req.setRequestMethod("POST")    req.setDoOutput(true)    req.setRequestProperty("token","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZW1zY210In0.7Kno6QoIFmT8nQv-C2edlP514ekqy9pPNID_Vf__DPc")    req.setRequestProperty("Content-Type", "application/json")    if (data != null) {        req.getOutputStream().write(data.getBytes("UTF-8"))    }    def postRC = req.getResponseCode()    println "response code:"+postRC    def body;    if(postRC.equals(200)) {        body = req.getInputStream().getText()        def code = parseJsonText(body).code        println "response paas json code:"+code        if (code != '000000') {            error "ERROR: request " + url + " " + code +  " error.\n" + body        }        println("result:\n" + body)    }else{        println "ERROR: request " + url+ " " + postRC + " error."        error req.getInputStream().getText()    }    return parseJsonText(body).body.content}def parseJsonText(String json) {    return new groovy.json.JsonSlurperClassic().parseText(json)}def handleException(res, msg) {    def code = parseJsonText(res).code    if (code != '000000') {        error "ERROR: " + msg + " " + code +  " \n" + res    }}node{stage('GIT拉取代码') {pipeLogId = addPipelineLog()def pipeStageId = 1130561945160317727try{isTagOrBranch = 'TAG'tagOrBranch = params.tagOrBranchcheckout([$class: 'GitSCM',branches: [[name: "${params.tagOrBranch}"]],userRemoteConfigs: [[url: 'http://10.145.196.76:9080/Shtel-PaaS-Platform/shtel-paas-service-gateway.git', credentialsId: 'c7887cee85a24fdfa8e372d317fa1d83']]])preExecuteEndPipelineStageCheck(pipeStageId)sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(currentBuild.currentResult, currentBuild.duration, getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))}catch(e){result = 'FAILURE'echo e.getMessage()result = setPreExecuteResult(result, e.getMessage())sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(result, currentBuild.duration, getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))sh(script: toEndPipelineLogCurlSh(result, pipeLogId, params.projectVersionConfigId, params.publishLogId))throw e}}}node{stage('Maven构建') {def mvnHome = tool 'maventool'def pipeStageId = 1130561945160317728try{sh "${mvnHome}/bin/mvn -f pom.xml clean package -X -U -Dmaven.test.skip=true"preExecuteEndPipelineStageCheck(pipeStageId)sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(currentBuild.currentResult, '', getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))}catch(e){result = 'FAILURE'echo e.getMessage()result = setPreExecuteResult(result, e.getMessage())sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(result, '', getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))sh(script: toEndPipelineLogCurlSh(result, pipeLogId, params.projectVersionConfigId, params.publishLogId))throw e}}}node{stage('Paas构建镜像') {def pipeStageId = 1130561945160317729try{ceEnvKey = 'test'ceRemoteAddress = 'http://10.145.208.200:31601'imgNamespaceName = 'te-msc-paas'repoName = 'te-msc-paas-gateway'codePackagePath = '*.tar.gz'hasAdditionalFile = falsecurlUploadFilePara = ''dockerFileType = 'INPUT'dockerfilePath = ''dockerFileContent = '''FROM hub.paas/base/centos-jdk8-cn:latestADD *.tar.gz /usr/local/gateway-service/RUN chmod u+x /usr/local/gateway-service/bin/run.shEXPOSE 8888CMD '/usr/local/gateway-service/bin/run.sh' '''def codeFilePath = getCodeFilePath(codePackagePath)def tagName = getImageNameByExactPath(codeFilePath, pipeLogId)buildPaasImage(ceRemoteAddress, imgNamespaceName, repoName, tagName, codeFilePath, hasAdditionalFile, curlUploadFilePara, dockerFileType, dockerfilePath, dockerFileContent)imageId = recordImageInfo(ceEnvKey, imgNamespaceName, repoName, tagName, isTagOrBranch, tagOrBranch, pipeLogId, pipeStageId)preExecuteEndPipelineStageCheck(pipeStageId)sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(currentBuild.currentResult, '', getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))}catch(e){result = 'FAILURE'echo e.getMessage()result = setPreExecuteResult(result, e.getMessage())sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(result, '', getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))sh(script: toEndPipelineLogCurlSh(result, pipeLogId, params.projectVersionConfigId, params.publishLogId))throw e}}}node{stage('paas发布部署') {def pipeStageId = 1130561945161366306try{deployPaasApp(pipeStageId, '*.tar.gz', pipeLogId)preExecuteEndPipelineStageCheck(pipeStageId)sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(currentBuild.currentResult, '', getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))sh(script: toEndPipelineLogCurlSh(currentBuild.currentResult, pipeLogId, params.projectVersionConfigId, params.publishLogId))}catch(e){result = 'FAILURE'echo e.getMessage()result = setPreExecuteResult(result, e.getMessage())sleep(unit: 'MILLISECONDS', time: 500)sh(script: toUpdatePipelineLogCurlSh(result, '', getStageLog(currentBuild.rawBuild.log), pipeLogId, pipeStageId))sh(script: toEndPipelineLogCurlSh(result, pipeLogId, params.projectVersionConfigId, params.publishLogId))throw e}}}node{    stage('clean workspace') {        cleanWs()    }}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905