wait:是否等待下游job构建完成。默认为true propagate:继承下游job的构建状态,如果下游job报错,则自己也报错 build(job:'下游job名',parameters:[string(name:'VERSION',value:env.VERSION)],propagate:true,wait:true) 1.
build(job:'下游job名',parameters:[string(name:'VERSION',value:env.VERSION)],propagate:true,wait:true) 1. 声明式 上游Job需有VERSION参数 JOB_NAME是Jenkins内置变量,代表当前Job的名字 下游job需有JOB参数 buildjob:'下游job名字',parameters:[string(name:'VERSION',value:env.VERSION),st...
既然存在参数化的pipeline,那么就表示可以在一个pipeline中“调用”另一个pipeline。在Jenkins pipeline中可以使用build步骤实现此功能。build步骤是pipeline插件的一个组件,所以不需要另外安装插件,可以直接使用。 build步骤其实也是一种触发pipeline执行的方式,它与triggers指令中的upstream方式有两个区别: (1)build步骤是...
build: Build a job Triggers a new build for a given job. job Name of a downstream job to build. May be another Pipeline job, but more commonly a freestyle or other project. Use a simple name if the job is in the same folder as this upstream Pipeline job; otherwise can use relative...
build job: "childPipeline2", propagate: true, wait: true } try { parallel map }catch(Exception e) { e.getCauses().each { echo "${it.getShortDescription()}" } } 实际的地图创建代码是动态的,如下所示- map["${substage}_${subdir}"] = {build job: "ci_pipeline_${substage}${jobSu...
//执行job build(job: name, propagate: false) } finally { //释放一个资源 latch.offer(thing) } } } timestamps { parallel branches } } } } } } 本质上,利用了java的LinkedBlockingDeque这个类,以下网站是介绍这个类: http://tool.osc...
item = build job: "${item}", propagate: false, wait: true, parameters: [ string(name:'project', value: "${projects_branch}"), string(name:'envs', value: "${projects_envs}"), ] println item.getResult() } buildDescription "测试环境:${projects_envs}构建项目:${projects_list}构建...
它应该是getResult(),状态应该是FAILURE,而不是Failed。 所以你的整个代码应该是这样的 pipeline { agent { label 'master' } stages { stage('test') { steps { script { def job_exec_details = build job: 'build_job', propagate: false, wait: true // Here wait: true means current running job...
将以上代码,写入到pipeline job配置的pipeline选项框中,注意,不能勾选Use Groovy Sandbox。 当然也可以把代码,写入到Jenkinsfile文件中,然后执行job需要执行的Jenkinsfile即可。 image.png 执行log如下,test1和test2首先执行,能够获取到资源,得到执行,之后的job,获取不到资源,然后被阻塞。
build 步骤的两个基本参数如下所示: job:必填参数,目标任务的名称 parameters:可选参数,目标任务的传入参数列表,使用方法与参数化命令parameters类似。 propagate:可选参数,布尔类型。若值为true,则只有当下游pipeline的运行结果状态为SUCCESS时,上游pipeline才算成功,若值为false,则忽略下游pipeline的运行结果...