简体   繁体   English

Jenkins 构建作业并行执行作业如何以编程方式创建作业而无需在 jenkins GUI 中创建管道

[英]Jenkins build job execute jobs in parallel how to create the programmatically without creating pipeline in jenkins GUI

i have 2 functions which I like to execute them in parallel, each job will run on slave or where there are enough resources.我有 2 个函数,我喜欢并行执行它们,每个作​​业将在从站或有足够资源的地方运行。 the problem is that I dont want to create pipelines in Jenkins GUI and then from that pipeline to execute my function.问题是我不想在 Jenkins GUI 中创建管道,然后从该管道执行我的功能。 i like to be able to create the pipeline on the fly in code.我喜欢能够在代码中即时创建管道。 this is example what i have now :这是我现在所拥有的示例:

//downstream job
build job: "my_job_pipeline_1",
parameters: [string(name: 'PROJECT_NAME', value: "${PROJECT_NAME}"),
propagate: false,
wait: true


//downstream job
build job: "my_job_pipeline_2", 
parameters: [string(name: 'PROJECT_NAME', value: "${PROJECT_NAME}"),
propagate: false,
wait: true 

This called from my main pipeline but for this to work I have to create 2 pipelines in Jenkins GUI这是从我的主管道调用的,但要使其工作,我必须在 Jenkins GUI 中创建 2 个管道
my_job_pipeline_2 and my_job_pipeline_1 my_job_pipeline_2 和 my_job_pipeline_1
can i create those pipelines programmatically ?我可以以编程方式创建这些管道吗?

The Jenkins CLI allows you to create jobs from the terminal. Jenkins CLI允许您从终端创建作业。 Follow the documentation to set it up.按照文档进行设置。 Under Manage Jenkins > Jenkins CLI you can find the available commands (including "create job")在 Manage Jenkins > Jenkins CLI 下,您可以找到可用的命令(包括“创建作业”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM