doc change: remove duplicate general job parameters
This change adds a test to validate the general job parameters and uses that test as documentation for the general module. It also replaces the doc of the general params in the top level definitions.rst with references to the general module. Change-Id: I3df04d69186ca49d7297f8141855a4c72c73be1e
This commit is contained in:
parent
ce8b716a5d
commit
051efc8595
@ -27,93 +27,9 @@ Job in YAML. It looks like this::
|
||||
|
||||
That's not very useful, so you'll want to add some actions such as
|
||||
:ref:`builders`, and perhaps :ref:`publishers`. Those are described
|
||||
later. There are a few basic optional fields for a Job definition::
|
||||
later.
|
||||
|
||||
- job:
|
||||
name: job-name
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
disabled: false
|
||||
display-name: 'Fancy job name'
|
||||
concurrent: true
|
||||
workspace: /srv/build-area/job-name
|
||||
quiet-period: 5
|
||||
block-downstream: false
|
||||
block-upstream: false
|
||||
retry-count: 3
|
||||
node: NodeLabel1 || NodeLabel2
|
||||
logrotate:
|
||||
daysToKeep: 3
|
||||
numToKeep: 20
|
||||
artifactDaysToKeep: -1
|
||||
artifactNumToKeep: -1
|
||||
|
||||
:Job Parameters:
|
||||
* **project-type**:
|
||||
Defaults to "freestyle", but "maven" as well as "multijob" or "flow"
|
||||
can also be specified.
|
||||
|
||||
* **defaults**:
|
||||
Specifies a set of :ref:`defaults` to use for this job, defaults to
|
||||
''global''. If you have values that are common to all of your jobs,
|
||||
create a ``global`` :ref:`defaults` object to hold them, and no further
|
||||
configuration of individual jobs is necessary. If some jobs
|
||||
should not use the ``global`` defaults, use this field to specify a
|
||||
different set of defaults.
|
||||
|
||||
* **disabled**:
|
||||
Boolean value to set whether or not this job should be disabled in
|
||||
Jenkins. Defaults to ``false`` (job will be enabled).
|
||||
|
||||
* **display-name**:
|
||||
Optional name shown for the project throughout the Jenkins web GUI in
|
||||
place of the actual job name. The jenkins_jobs tool cannot fully remove
|
||||
this trait once it is set, so use caution when setting it. Setting it to
|
||||
the same string as the job's name is an effective un-set workaround.
|
||||
Alternately, the field can be cleared manually using the Jenkins web
|
||||
interface.
|
||||
|
||||
* **concurrent**:
|
||||
Boolean value to set whether or not Jenkins can run this job
|
||||
concurrently. Defaults to ``false``.
|
||||
|
||||
* **workspace**:
|
||||
Path for a custom workspace. Defaults to Jenkins default
|
||||
configuration.
|
||||
|
||||
* **quiet-period**:
|
||||
Number of seconds to wait between consecutive runs of this job.
|
||||
Defaults to ``0``.
|
||||
|
||||
* **block-downstream**:
|
||||
Boolean value to set whether or not this job must block while
|
||||
downstream jobs are running. Downstream jobs are determined
|
||||
transitively. Defaults to ``false``.
|
||||
|
||||
* **block-upstream**:
|
||||
Boolean value to set whether or not this job must block while
|
||||
upstream jobs are running. Upstream jobs are determined
|
||||
transitively. Defaults to ``false``.
|
||||
|
||||
* **auth-token**:
|
||||
Specifies an authentication token that allows new builds to be
|
||||
triggered by accessing a special predefined URL. Only those who
|
||||
know the token will be able to trigger builds remotely.
|
||||
|
||||
* **retry-count**:
|
||||
If a build fails to checkout from the repository, Jenkins will
|
||||
retry the specified number of times before giving up.
|
||||
|
||||
* **node**:
|
||||
Restrict where this job can be run. If there is a group of
|
||||
machines that the job can be built on, you can specify that
|
||||
label as the node to tie on, which will cause Jenkins to build
|
||||
the job on any of the machines with that label.
|
||||
|
||||
* **logrotate**:
|
||||
The Logrotate section allows you to automatically remove old build
|
||||
history. It adds the ``logrotate`` attribute to the :ref:`Job`
|
||||
definition. All logrotate attributes default to "-1" (keep forever).
|
||||
.. automodule:: jenkins_jobs.modules.general
|
||||
|
||||
.. _job-template:
|
||||
|
||||
|
@ -13,37 +13,84 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
"""These are job parameters that are common to every type of Jenkins job.
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/yamlparser/fixtures/general-example-001.yaml
|
||||
|
||||
:Job Parameters:
|
||||
* **project-type**:
|
||||
Defaults to "freestyle", but "maven" as well as "multijob" or "flow"
|
||||
can also be specified.
|
||||
|
||||
* **defaults**:
|
||||
Specifies a set of :ref:`defaults` to use for this job, defaults to
|
||||
''global''. If you have values that are common to all of your jobs,
|
||||
create a ``global`` :ref:`defaults` object to hold them, and no further
|
||||
configuration of individual jobs is necessary. If some jobs
|
||||
should not use the ``global`` defaults, use this field to specify a
|
||||
different set of defaults.
|
||||
|
||||
* **description**:
|
||||
The description for the job. By default, the description
|
||||
"!-- Managed by Jenkins Job Builder" is applied.
|
||||
|
||||
* **disabled**:
|
||||
Boolean value to set whether or not this job should be disabled in
|
||||
Jenkins. Defaults to ``false`` (job will be enabled).
|
||||
|
||||
* **display-name**:
|
||||
Optional name shown for the project throughout the Jenkins web GUI in
|
||||
place of the actual job name. The jenkins_jobs tool cannot fully remove
|
||||
this trait once it is set, so use caution when setting it. Setting it to
|
||||
the same string as the job's name is an effective un-set workaround.
|
||||
Alternately, the field can be cleared manually using the Jenkins web
|
||||
interface.
|
||||
|
||||
* **concurrent**:
|
||||
Boolean value to set whether or not Jenkins can run this job
|
||||
concurrently. Defaults to ``false``.
|
||||
|
||||
* **workspace**:
|
||||
Path for a custom workspace. Defaults to Jenkins default
|
||||
configuration.
|
||||
|
||||
* **quiet-period**:
|
||||
Number of seconds to wait between consecutive runs of this job.
|
||||
Defaults to ``0``.
|
||||
|
||||
* **block-downstream**:
|
||||
Boolean value to set whether or not this job must block while
|
||||
downstream jobs are running. Downstream jobs are determined
|
||||
transitively. Defaults to ``false``.
|
||||
|
||||
* **block-upstream**:
|
||||
Boolean value to set whether or not this job must block while
|
||||
upstream jobs are running. Upstream jobs are determined
|
||||
transitively. Defaults to ``false``.
|
||||
|
||||
* **auth-token**:
|
||||
Specifies an authentication token that allows new builds to be
|
||||
triggered by accessing a special predefined URL. Only those who
|
||||
know the token will be able to trigger builds remotely.
|
||||
|
||||
* **retry-count**:
|
||||
If a build fails to checkout from the repository, Jenkins will
|
||||
retry the specified number of times before giving up.
|
||||
|
||||
* **node**:
|
||||
Restrict where this job can be run. If there is a group of
|
||||
machines that the job can be built on, you can specify that
|
||||
label as the node to tie on, which will cause Jenkins to build
|
||||
the job on any of the machines with that label.
|
||||
|
||||
* **logrotate**:
|
||||
The Logrotate section allows you to automatically remove old build
|
||||
history. It adds the ``logrotate`` attribute to the :ref:`Job`
|
||||
definition. All logrotate attributes default to "-1" (keep forever).
|
||||
|
||||
"""
|
||||
The Logrotate section allows you to automatically remove old build
|
||||
history. It adds the ``logrotate`` attribute to the :ref:`Job`
|
||||
definition.
|
||||
All logrotate attributes have default "-1" value so you don't need to specify
|
||||
that explicitly
|
||||
|
||||
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 :ref:`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``.
|
||||
"""
|
||||
|
||||
|
||||
import xml.etree.ElementTree as XML
|
||||
import jenkins_jobs.modules.base
|
||||
|
27
tests/yamlparser/fixtures/general-example-001.xml
Normal file
27
tests/yamlparser/fixtures/general-example-001.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<actions/>
|
||||
<description>Do not edit this job through the web!<!-- Managed by Jenkins Job Builder --></description>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<disabled>false</disabled>
|
||||
<displayName>Fancy job name</displayName>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>true</concurrentBuild>
|
||||
<customWorkspace>/srv/build-area/job-name</customWorkspace>
|
||||
<quietPeriod>5</quietPeriod>
|
||||
<assignedNode>NodeLabel1 || NodeLabel2</assignedNode>
|
||||
<canRoam>false</canRoam>
|
||||
<scmCheckoutRetryCount>3</scmCheckoutRetryCount>
|
||||
<logRotator>
|
||||
<daysToKeep>3</daysToKeep>
|
||||
<numToKeep>20</numToKeep>
|
||||
<artifactDaysToKeep>-1</artifactDaysToKeep>
|
||||
<artifactNumToKeep>-1</artifactNumToKeep>
|
||||
</logRotator>
|
||||
<properties/>
|
||||
<scm class="hudson.scm.NullSCM"/>
|
||||
<builders/>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
19
tests/yamlparser/fixtures/general-example-001.yaml
Normal file
19
tests/yamlparser/fixtures/general-example-001.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
- job:
|
||||
name: job-name
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: 'Do not edit this job through the web!'
|
||||
disabled: false
|
||||
display-name: 'Fancy job name'
|
||||
concurrent: true
|
||||
workspace: /srv/build-area/job-name
|
||||
quiet-period: 5
|
||||
block-downstream: false
|
||||
block-upstream: false
|
||||
retry-count: 3
|
||||
node: NodeLabel1 || NodeLabel2
|
||||
logrotate:
|
||||
daysToKeep: 3
|
||||
numToKeep: 20
|
||||
artifactDaysToKeep: -1
|
||||
artifactNumToKeep: -1
|
Loading…
x
Reference in New Issue
Block a user