来自:http://techs.enovance.com/6006/manage-jenkins-jobs-with-yaml

 You are here: Home ∼ Manage Jenkins Jobs with YAML

About Jenkins Job Builder

Jenkins jobs are stored in XML format on the Continuous Integration (CI) server which is not the best readable format to write a job manually. That’s why it’s highly preferable to manage jobs via graphic interface.

Jenkins Job Builder (JJB) is a software created by the OpenStack infra team which takes simple descriptions of Jenkins jobs in YAML format and uses them to configure Jenkins. That enables you to manage jobs in human readable text format and store them in a version control system. Also, JJB is able to configure remotly Jenkins with new jobs. By creating a template system, you can easily manage jobs with similar configurations. Also, you can store YAML files into your favorite CSV (called subversion control) to manage versionning on them.

How does it work ?

This is a conceptual picture of the workflow :Manage Jenkins Jobs with YAML

First of all, you need to install jenkins-job-builder:

 

 
1
2
3
//github.com/openstack-infra/jenkins-job-builder
builder
install

 

Configure /etc/jenkins_jobs/jenkins_jobs.ini file :

 

 
1
2
3
4
]
USERNAME
PASSWORD
JENKINS_URL

 

Write now your own YAML file with the job decsription. Before pushing it into Jenkins you could test it by generate a XML file:

 

 
1
.

 

It’s actually useful if you want to convert current jobs into YAML format and check that XML output is what we have currently on Jenkins Server.

When you are ready, let’s go to update the job on our Jenkins server:

 

 
1
yaml

 

Read the official documentation for more informations.

Job example

To picture you why it’s so simple to write a job in YAML, here is an example with eDeploy Unit tests:

 

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
:
YAML
'Do not edit this job through the web!'
freestyle
false
:
:
false
git
:
'@hourly'
:
|
dxf
:
:
:
log
do
log
:
:
:
:
:
log
PyFlakes
:
xml
:
sc
:
:
xml
:
log
:
com

 

Recent contributions

To support more Jenkins plugins, we contributed some JJB publishers. These publishers translate YAML into XML for the following plugins:

  • SLOCCount which generates the trend report for SLOCCount, an open source program which counts the number of lines of codes in over 25 different languages.
  • Plot which provides generic plotting (or graphing) in Jenkins.
  • IRCbot which enable Jenkins to send build notífications via IRC and lets you interact with Jenkins via an IRC bot.

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2021-06-01
  • 2022-12-23
  • 2022-03-10
  • 2022-12-23
  • 2021-08-24
  • 2021-07-18
猜你喜欢
  • 2021-06-03
  • 2021-12-08
  • 2022-12-23
  • 2022-01-30
  • 2019-05-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案