Manage Jenkins Jobs with YAML

本文介绍了如何使用Jenkins Job Builder (JJB)通过YAML格式来管理Jenkins工作流,包括安装、配置、编写YAML文件、测试及更新工作流。详细解释了如何将现有工作流转换为YAML格式并验证XML输出,以及如何利用模板系统轻松管理具有相似配置的工作流。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 You are here: Home ∼ Manage Jenkins Jobs with YAML

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 :jjb

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

 

 

Configure /etc/jenkins_jobs/jenkins_jobs.ini file :

 

 

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

 

 

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:

 

 

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:

 

 

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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值