Commit Graph

190 Commits (b67c0bc754bfa2dd79921f4eb7a47ec1ded6690e)

Author SHA1 Message Date
sbussetti cf152d67c7 Adds named branches to property strategy support
My previous submission added support for property strategy: all branches
get the same properties.  This patch adds support for the second of 2
options, "named branches get different properties", which allows for
a default definition of properties + exceptions for individual refspecs
based on their literal branch name.  Also includes some re-org of the
existing prop. strat. support in order to DRY up the code for both.

Also adds sphinx.ext.doctest to docs/src/ extensions to allow for
running `make doctest` locally.

Change-Id: Icd143fe25b1e2d5c8d1e7e8b0650d91f40838043
Signed-off-by: sbussetti <>
5 years ago
sbussetti 7d065af894 Adds support for Disable GitHub Multibranch Status
Jenkins2 GitHub scms default to automatically sending updates on build
status to github for pull requests.  The plugin this enables allows
control of this by enabling or disabling the feature via an SCM trait,
allowing you to either no notify at all or manually notify via other

Change-Id: I4f5629c3ee8031d41054e3be5e853201d8f0fed6
Signed-off-by: sbussetti <>
5 years ago
Anil Belur 9399b1f986
Add config options --jobs-only and --views-only
Add options --jobs-only and --views-only to job_builder
section in config file.

By default JJB updates both jobs and views. Some cases
non-admin users are not allowed to update views on Jenkins
which requires explicity using -j flag.

Allow users to set a config option 'update=jobs|views|all'
in the 'job_builder' section implicitly use --jobs-only or
--views-only and control these flags from the config file.

Note: CLI options takes precedence over the config file.

Change-Id: I2a94e5a2d671ccbfc505de2f19b578ecfef9e9d7
Co-Authored-By: Thanh Ha <>
Signed-off-by: Anil Belur <>
Signed-off-by: Thanh Ha <>
Signed-off-by: Anil Belur <>
5 years ago
Thanh Ha ce040d8ad6
Document practical use case for variable defaults
Took inspiration from my StackOverflow reply here to document a practical
use of setting variable defaults and inheritenence.

Change-Id: I45934341d3ff3fbf4ff711a435924197d2f12712
Signed-off-by: Thanh Ha <>
5 years ago
Sorin Sbarnea 4953756c27
adopt pre-commit hooks
Change-Id: I98bc0b5717c3921b35e74f53c55f896427880a84
Signed-off-by: Sorin Sbarnea <>
5 years ago
Sorin Sbarnea c2781e670f
Normalize newlines at end of file
Preparatory move for adopting pre-commit hooks.
Shoudl only remove newlines and spaces at end of files.

Change-Id: Ia33679467c533722b9308f7e7b74be395c926428
Signed-off-by: Sorin Sbarnea <>
5 years ago
Vicky Chijwani 75d78b6540 Add retain_anchors config option.
If set to True, YAML anchors can be referenced across files, allowing jobs to be
composed from bits of YAML defined in separate files. False by default.

Story: 2000338
Task: 2547
Change-Id: I034ce3bce0030093cb8d4266dabbdb06d96306d6
5 years ago
Zuul 18bf3239c0 Merge "Add support for view-templates" 5 years ago
Anushka Bhandari a77d29dcd5 Fix a typo in doc
Fix correct link to CloudBees Folders Plugin
Add missing comma in line 1290 of module wrappers

Change-Id: Idb0311064945965c58c0cc608fc6cab00eef3ee9
5 years ago
Zuul 96f112e915 Merge "Document use of | character for variable defaults" 5 years ago
Luca Pierri 3264b244b5 fix spelling errors
Change-Id: I42b6bb46a9e5574f88ec5c0cb5726a65353a4fd7
5 years ago
Thanh Ha 90663ea8a6
Document use of | character for variable defaults
Change-Id: Id20fc7a49fef6684170a73834f2df06db3f0ca7f
Signed-off-by: Thanh Ha <>
5 years ago
Thanh Ha 418e7c628d Add support for view-templates
Allow views to also be configured via templates similar to

This adds a new project key called "views" and parser type called
"view-template" allowing the user to add custom views.


- view-template:
    name: '{name}-template-{seq}'
    description: 'testing view templates feature'
    view-type: list
    regex: 'test-view-.*'

- project:
    name: 'test-view'
        - '{name}-template-{seq}'
        - a
        - b
        - c

Change-Id: I6eb225f24bc3c7d790c7dcab6391735c579ac71a
Signed-off-by: Thanh Ha <>
5 years ago
Joost van der Griendt efc5fbe0fd Add multibranch project-type
This work was based on original work done by
Joshua Harlow on top of older code from:

Credit is due to `Joost van der Griendt` for doing this
work. This builds on his work in that repo, and adjusts it
so that it can get merged into upstream and released
as a fully supported job type.

SCM implementation is different than than normal SCM module,
supporting: BitBucket, git, and GitHub in this initial

Change-Id: If50a54d282dd7d901c16edb9fe04874bdd83c9ef
Co-Authored-By: Joshua Harlow <>
Co-Authored-By: Sorin Sbarnea <>
Co-Authored-By: Thanh Ha <>
Signed-off-by: Sorin Sbarnea <>
Signed-off-by: Thanh Ha <>
Signed-off-by: Sorin Sbarnea <>
5 years ago
Major Hayden 14f7bbcc3b
[Docs] Ensure commands are monospaced
Change-Id: Iee9f8c8831ee83ea23677fdbdd20eb2ae7709d29
Signed-off-by: Major Hayden <>
5 years ago
Zuul 2da47d901b Merge "Add views and jobs only options for update" 5 years ago
Zuul 92fcbab123 Merge "docs: sphinx upgrade and warnings as erros" 5 years ago
Zuul 5da4f97e23 Merge "Allow template-name in the global defaults" 5 years ago
Sorin Sbarnea d8ace6802d docs: sphinx upgrade and warnings as erros
Change-Id: I455ac0d79cca3883d3a758a2709c8c0255f4cc7d
5 years ago
Zuul 8d489abece Merge "Added option to print job names as urls" 5 years ago
Sorin Sbarnea b76ed1629d Added option to print job names as urls
Add print_job_urls = True to [job_builder] to enable output as urls
instead of simple job names when changing them.

Change-Id: I3454606a50ca385c87d8c13d3eab5d30d94cf02f
Signed-off-by: Sorin Sbarnea <>
5 years ago
Anil Belur ad61af1670
Add views and jobs only options for update
JJB 2.0 update does not allow updating only views
or jobs which would be useful, which is implemented with
delete and delete-all. This patch add's thoses flags
for the update option.

Change-Id: I3712c8552ea83a4c29c05461894c4464aa41230f
Signed-off-by: Anil Belur <>
5 years ago
Thanh Ha 06bc48c0fd
Fix view definition documentation
View documentation was not properly being generated and linked
in the index. Let's add that in.

Change-Id: I6197dbecc89ddcf8c6f6b0e6a3d4c517224dc77b
Signed-off-by: Thanh Ha <>
5 years ago
Jan Hruban 28cab53d5d Allow template-name in the global defaults
Inject the template-name into parameters earlier, so it's possible to
use it in the global defaults. Mark the template name as 'verbatim' so
the interpolation is skipped by the formatter.

Change-Id: I5d98e32ed2bedaa6b536e61fbdec589f358f861f
5 years ago
Zuul a23f8bf8db Merge "Add cloudbees folder creation support" 6 years ago
Jerome Hourquebie 8bcd0d0bd2
Add cloudbees folder creation support
Add project folder module. Jenkins folder could be made with project-type: folder
This requires Cloudbees folder plugin and python-jenkins folder update

Change-Id: I7e1c28c26a69ae6ca736cec88fcb957a716d8fad
6 years ago
Darragh Bailey af9d984baa
Basic folder support
Allows specifying a folder attribute for each job generated, which in
turn is used when creating or uploading to place the job under the
requested folder.

The job name is expanded after defaults are applied, to support the
attribute being defined within a set of defaults applied to a number of

This in turn allows for multiple jobs with the same basename to exist,
provided they are targeted at different folders.

Does not support creating the folders if they do not exist.

Change-Id: I8c2157c4c81087cc972a048d1b88d5f08ac65361
6 years ago
Jenkins 5be08a5be6 Merge "Allow update to provide plugin_info via yaml" 6 years ago
Thanh Ha 2974f1e636
Allow update to provide plugin_info via yaml
Getting plugin info requires Administrator permissions. It seems the
test command allows providing the plugin_info details via a yaml
configuration file. This patch allows the same command to be passed to
the update command to allow us to configure the plugin versions manually
and not require administrator permissions.

Additionally this patch adds a new command called get-plugins-info
which can create the plugins_info.yaml file to pass to the


Change-Id: I5a34979407d863a84f34afbf8f565081ec52190a
Signed-off-by: Thanh Ha <>
6 years ago
Thanh Ha ecdb180c8d
Document JJB 2.0 plugin config default behaviour
Document the behaviour change in JJB 2.0 to default configuration to the
latest supported version. These series of changes were modified via the
topic:2.0-config-format in Gerrit.

Change-Id: I96160bd63c39a1346f1eefd24eda475cfb30caf3
Signed-off-by: Thanh Ha <>
6 years ago
Daniel Watkins d9f0958627 Update Sphinx extlinks for new Jenkins domain name
The Jenkins website, including the wiki subdomain, has moved from to

Change-Id: Idd3eae89fdc2363979b4cf33903a0d09b6ae49ae
6 years ago
Peter Eisentraut 919052714c Add option to make test output file layout match Jenkins
Before, `jenkins-job-builder test -o outdir` would write


With the new option `--config-xml`, it writes


to match the layout that Jenkins uses internally.  This is more useful
for diffing against existing Jenkins installations or uploading job
definitions by other means.

Also, it seems better to give the output files an .xml extension.

Change-Id: I78fc7aff531925ee071b8e19f40f766b4af0b5ad
6 years ago
Thanh Ha 111f4512d5
Add note regarding a bug with !include-raw-escape
This spawned from discussions on the mailing list:

Change-Id: I7916ebec86350fa760bb02b6bde38e27c71dc359
Signed-off-by: Thanh Ha <>
6 years ago
Yann Voté 2fc361949c Add Pipeline job type and deprecate Workflow
Since introduction of the Jenkins Pipeline plugin
(, one can
configure a Pipeline job using a Groovy file lying with the source code

We add support here for this kind of jobs, introducing a new component:
pipeline-scm. This component contains information about the repository to
clone and the name of the file where the job configuration can be found.

Since Workflow plugin is just an old name for the Pipeline plugin,
Workflow job type can be deprecated in favor of Pipeline job type to
avoid confusion and keep JJB in line with the terms used in Jenkins.

Change-Id: I098b9673c44b1281fa0954193d8fadf273685386
Story: 2000573
Task: 2974
6 years ago
Darragh Bailey 146d285eb9 Support default string values for variables
Provide syntax support for specifying default values to be substituted
for variables during deep_format when no other replacement is provided.

Allows for individual variables to have a default or be optionally blank
should nothing be placed after the custom specifier.

Change-Id: Ib97a33a2bbca123791d4ca6ef5248ed200992565
7 years ago
Thanh Ha 1deb3aff4c
Add view management functionality
- Adds the ability for JJB to work with views
- Views can be created, updated, and deleted.
- New modules for List view and Build Pipeline view are added
- New tests for testing the deletion of views

Example View configuration:

    - view:
        name: MyView
        view-type: list

Change-Id: Idb29a4407bcc14593e10a4d951036cb04e8e6c27
Co-Authored-By: Brandon Leonard <>
Co-Authored-By: Joao Vale <>
Co-Authored-By: Lucas Dutra Nunes <>
Signed-off-by: Thanh Ha <>
7 years ago
Jenkins fcf2d9860b Merge "Add comment about proxy env pass through" 7 years ago
Ryo Tagami 784de85973 Add Workflow Project Documentation
Even though the module for workflow project (a.k.a. pipeline project) is
already there, documentation for it is missing.  Add the index file to
the doc tree to generate the documentation.

Change-Id: I003d235867d58d12c7bcab83c54c7eca95d32ca9
Signed-off-by: Ryo Tagami <>
7 years ago
Darragh Bailey e165b78546 Add comment about proxy env pass through
For users in a proxy environment, checking the doc urls requires being
able to pass through the proxy environment variables. Include a simple
comment along with the tox command requiring it to help users checking
any links added are valid.

Add some references to documentation, both in the detailed
documentation and the quick README.rst that would be more commonly

Change-Id: I2316bc1b7e845c29a8b248eef4668a6099d109f7
7 years ago
Jonathan Perret 2a050be26d Fix documentation of --delete-old: affects only managed jobs.
As far back as its introduction (2cefa400), the `--delete-old` option
has only ever deleted jobs that were marked with the special
"<!-- Managed by Jenkins Job Builder -->" comment that JJB adds to

This change fixes the documentation of the `--delete-old` option,
which erroneously used to state that even jobs that were never
managed by JJB would be subject to deletion.

The test for the feature was slightly enriched as well: the fact
that unmanaged jobs were not deleted, was not actually tested.

Change-Id: I438a7b555b6e122869988b3a2b9ea40896004122
7 years ago
Alexander Couzens ca40fb7f87 doc/definition.rst: add missing '/' into include path
Change-Id: If07710333cbb84ce70d6d4fa40602a74c898c08a
7 years ago
Jenkins 223cb3530d Merge "Document template variable default values" 7 years ago
Terry Howe aa41127ef7 Change documentation to install from pypi
Change-Id: I46fe46d0af14563b2e87492c2abe1b39ec246714
7 years ago
Jenkins 88ae2df307 Merge "Take parameter order from yaml in trigger_parameterized_builds" 7 years ago
Jenkins 5d14a621a0 Merge "Allow id's for different templates to follow same naming" 7 years ago
Jenkins dc7e1b0aa2 Merge "Added possibility to exclude project combinations" 7 years ago
Sebastian Schuberth dbe63dd9d2 cmd: Add a config file fallback to the user's home directory
The system-global path of


is not applicable on Windows. To solve that, and as Linux users would
benefit from a per-user configuration file, too, introduce a fallback at


following the XDG Base Directory Specification. Try to use that per-user
file if no configuration file is given on the command line and none is
present in the script directory for development purposes.

Change-Id: I1a22454999ee8ac60d6f22545850c33aa03bb29b
7 years ago
David Caro d4fa9d7b23 Added possibility to exclude project combinations
Change-Id: I40603f041d33a27d08bf6912b7d9d885a95278fd
Signed-off-by: David Caro <>
7 years ago
Darragh Bailey 3e8c31fe94 Take parameter order from yaml in trigger_parameterized_builds
Support taking the order of the parameters to be passed through to a
triggered parameterized build from the user defined yaml via config
option. Use the existing order by default so as not to break current

The XML ordering of the parameters matters since when the same parameter
is defined through multiple sources, Jenkins uses the ordering to
determine which will be the one that that should win.

ie if FOO=BAR is set as a build parameter of the current job and a
properties file is generated during build that attempts to set FOO=BAZ;
the XML ordering determines which value, BAZ or BAR, that the triggered
job sees for the parameter FOO.

Change-Id: Ia0dafad8ed3976e7b0b11feb6b3af844bbda9d4a
7 years ago
Adam Harwell 9bb036379c Update docs to include installation via pypi
Change-Id: Iad36cba6cc27770c69499ec7c402ff48f1f0380e
7 years ago