diff options
author | Wayne <wayne@puppetlabs.com> | 2015-06-19 08:23:37 -0700 |
---|---|---|
committer | Wayne <wayne@puppetlabs.com> | 2015-06-19 09:37:12 -0700 |
commit | 815b7f0f6969c8772603eb856e557d6f9abe274e (patch) | |
tree | 4a6594fba23be6dde8742c0efaa4c9b98a291d47 | |
parent | 6fe462651881f596f6f7e8fac738686bd8e5d6d5 (diff) | |
download | python-jenkins-job-builder-815b7f0f6969c8772603eb856e557d6f9abe274e.tar.gz python-jenkins-job-builder-815b7f0f6969c8772603eb856e557d6f9abe274e.tar.xz python-jenkins-job-builder-815b7f0f6969c8772603eb856e557d6f9abe274e.zip |
Validate the use of `[]` as an `scm` value
This is necessary in the case where global defaults sets a templated `scm` value
used by most jobs but which is undesirable for a minority of jobs and where it
would be inconvenient to copy all the desired settings out of the global
defaults into a custom defaults just for that particular set of jobs.
Change-Id: I201c29215a7090b81e84b9d494bd2cf6ea0370ad
-rw-r--r-- | jenkins_jobs/modules/scm.py | 8 | ||||
-rw-r--r-- | tests/scm/fixtures/empty.xml | 4 | ||||
-rw-r--r-- | tests/scm/fixtures/empty.yaml | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py index eaa3106b..7f54a27a 100644 --- a/jenkins_jobs/modules/scm.py +++ b/jenkins_jobs/modules/scm.py @@ -16,7 +16,10 @@ """ The SCM module allows you to specify the source code location for the project. It adds the ``scm`` attribute to the :ref:`Job` definition, -which accepts any number of scm definitions. +which accepts any number of scm definitions. It is also possible to pass +``[]`` to the ``scm`` attribute. This is useful when a set of configs has a +global default ``scm`` and you want to a particular job to override that +default with no SCM. **Component**: scm :Macro: scm @@ -28,6 +31,9 @@ Note: Adding more than one scm definition requires the Jenkins Example of multiple repositories in a single job: .. literalinclude:: /../../tests/macros/fixtures/scm/multi-scms001.yaml + +Example of an empty ``scm``: + .. literalinclude:: /../../tests/scm/fixtures/empty.yaml """ import logging diff --git a/tests/scm/fixtures/empty.xml b/tests/scm/fixtures/empty.xml new file mode 100644 index 00000000..3d3881e7 --- /dev/null +++ b/tests/scm/fixtures/empty.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <scm class="hudson.scm.NullSCM"/> +</project> diff --git a/tests/scm/fixtures/empty.yaml b/tests/scm/fixtures/empty.yaml new file mode 100644 index 00000000..17a84dc4 --- /dev/null +++ b/tests/scm/fixtures/empty.yaml @@ -0,0 +1 @@ +scm: [] |