The most straightforward way to create a job is simply to define a Job in YAML. It looks like this:
- job:
name: job-name
That’s not very useful, so you’ll want to add some actions such as Builders, and perhaps Publishers. Those are described later. There are a few basic optional fields for a Job definition:
- job:
name: job-name
project-type: freestyle
defaults: global
disabled: false
concurrent: true
quiet-period: 5
block-downstream: false
block-upstream: false
Job Parameters: |
|
---|
The Logrotate section allows you to automatically remove old build history. It adds the logrotate attribute to the Job definition.
Example:
- job:
name: test_job
logrotate:
daysToKeep: 3
numToKeep: 20
artifactDaysToKeep: -1
artifactNumToKeep: -1
The Assigned Node section allows you to specify which Jenkins node (or named group) should run the specified job. It adds the node attribute to the Job definition.
Example:
- job:
name: test_job
node: precise
That speficies that the job should be run on a Jenkins node or node group named precise.