zoukankan      html  css  js  c++  java
  • jenkins多job并发

    现在大系统都是用一个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%

  • 相关阅读:
    下载安装ActiveMQ(消息队列)
    互联网项目架构之基于服务的分布式架构
    Shell报错bash^M /bin/bash^M: bad interpreter: No such file or directory
    rpm参数
    zabbix3.4+grafana5.0.1数据可视化
    Linux下目录栈操作详解
    有惊无险,拯救zabbix网页端
    tomcat7 开启gzip压缩
    欢迎使用CSDN-markdown基本语法
    新项目平台后台测试环境搭建
  • 原文地址:https://www.cnblogs.com/opama/p/8213722.html
Copyright © 2011-2022 走看看