jenkins use the pipeline to handle multiple projects simultaneously released

Use jenkins packaged multi-module maven project, use the pipeline to go several steps.

 

 

Task 1

1, download the code

By git Download

 

2, compiler package

By clean install maven of bale.

But here we have all of a git project gave the jar package downloaded packaged.

3, released to the mirror warehouse

At this time, if we have a need to publish multiple packages, we do not need is not a repeat of the pack. Only one package, repeatedly push

4, to get the image deployment docker container from the image repository.

 

Page layout

A first need to install plug-ins can occur check box.

Extended Choice Parameter

 

B Create a new pipeline project

 

 

 

C add parameters, type selection

 

 

 

 D configuration parameters selected content.

 

 

 Top E a pipeline to do something, select.

 

 

 Script reads as follows:

// define the content of a project execution. . Here write your own. 
def doOneProject (p_name) { Stage (
'the current execution Engineering ' ) { echo "${p_name}"
........... } Stage ( 'project execution result " ) { echo " end p_name} {$ " } } the Node ( " $ {nodeTag} " ) {
// get the contents of the selected page def projectNameChoose
="${projectNameChoose}"
// 第一步显示出选择的 stage('show projectNameChoose') { echo projectNameChoose } stage('run all') { for (p_name in projectNameChoose.tokenize(',')){ doOneProject(p_name) } } }

 

F保存,运行。

 

 G选择参数信息。执行。

 

 H查看运行日志结果。

 

 

I查看控制台日志

 

 

J结束。完美。

 

Guess you like

Origin www.cnblogs.com/a393060727/p/12214548.html
Recommended