码迷,mamicode.com
首页 > 其他好文 > 详细

jenkins多job并发

时间:2018-01-06 14:09:45      阅读:1667      评论:0      收藏:0      [点我收藏+]

标签:fit   gateway   image   bubuko   branch   line   param   技术分享   运行时   

 

现在大系统都是用一个deploy job去部署,在pipeline里面配置了多个job,运行时间很长,所以考虑优化一下

stage (scrm deploy jobs){ 
build job: perf.scrm.deploy,parameters: [[$class: StringParameterValue, name: scrm_branch, value: params.scrm_branch]]
build job: perf.scrm-credit-base.deploy,parameters: [[$class: StringParameterValue, name: scrm_credit_base_branch, value: params.scrm_credit_base_branch]]
build job: perf.scrm-credit-core.deploy,parameters: [[$class: StringParameterValue, name: scrm_credit_core_branch, value: params.scrm_credit_core_branch]]
build job: perf.scrm-funds-core.deploy,parameters: [[$class: StringParameterValue, name: scrm_funds_core_branch, value: params.scrm_funds_core_branch]]
build job: perf.customerbase.deploy,parameters: [[$class: StringParameterValue, name: customerbase_branch, value: params.customerbase_branch]]
build job: perf.scrm-gateway.deploy,parameters: [[$class: StringParameterValue, name: gateway_branch, value: params.gateway_branch]]
build job: perf.scrm-behavior.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
build job: perf.scrm-behavior-job.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
build job: perf.scrm-search-core.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
build job: perf.scrm-search-job.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
build job: perf.scrm-customer-core-j.deploy,parameters : [[$class: StringParameterValue, name: scrm_customer_core_j_branch, value: params.scrm_customer_core_j_branch]]
}

 看了下jenkins里面的语法提示

技术分享图片

改造成并发比较容易,不过考虑到有些模块之间的依赖关系,所以分组设置,不同组之间可以并发部署

stage (scrm deploy jobs){
    
    parallel scrm.deploy:{
    build job: perf.scrm.deploy,parameters: [[$class: StringParameterValue, name: scrm_branch, value: params.scrm_branch]]
    },scrm-credit:{
    build job: perf.scrm-credit-base.deploy,parameters: [[$class: StringParameterValue, name: scrm_credit_base_branch, value: params.scrm_credit_base_branch]]
    build job: perf.scrm-credit-core.deploy,parameters: [[$class: StringParameterValue, name: scrm_credit_core_branch, value: params.scrm_credit_core_branch]]
    },scrm-funds:{
    build job: perf.scrm-funds-core.deploy,parameters: [[$class: StringParameterValue, name: scrm_funds_core_branch, value: params.scrm_funds_core_branch]]
    },scrm-customer:{
    build job: perf.scrm-customer-core-j.deploy,parameters : [[$class: StringParameterValue, name: scrm_customer_core_j_branch, value: params.scrm_customer_core_j_branch]]
    build job: perf.customerbase.deploy,parameters: [[$class: StringParameterValue, name: customerbase_branch, value: params.customerbase_branch]]
    },scrm-gateway:{
    build job: perf.scrm-gateway.deploy,parameters: [[$class: StringParameterValue, name: gateway_branch, value: params.gateway_branch]]
    },scrm-behavior:{
    build job: perf.scrm-behavior.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
    build job: perf.scrm-behavior-job.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
    },scrm-search:{
    build job: perf.scrm-search-core.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
    build job: perf.scrm-search-job.deploy,parameters : [[$class: StringParameterValue, name: behavior_branch, value: params.behavior_branch]]
    },scrm-benefit:{
    build job: perf.benefit-core.deploy,parameters : [[$class: StringParameterValue, name: core_branch, value: params.scrm_benefit_branch]]
    build job: perf.benefit-base.deploy,parameters : [[$class: StringParameterValue, name: base_branch, value: params.scrm_benefit_branch]]
    }
        
}

 

执行后查看,各个分组已经可以同时运行

技术分享图片

 

最后查看执行时间,缩短了80%

技术分享图片

 

jenkins多job并发

标签:fit   gateway   image   bubuko   branch   line   param   技术分享   运行时   

原文地址:https://www.cnblogs.com/opama/p/8213722.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!