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/conf.py extensions to allow for
running `make doctest` locally.
Change-Id: Icd143fe25b1e2d5c8d1e7e8b0650d91f40838043
Signed-off-by: sbussetti <steve.bussetti@gmail.com>
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
means.
Change-Id: I4f5629c3ee8031d41054e3be5e853201d8f0fed6
Signed-off-by: sbussetti <steve.bussetti@gmail.com>
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 <zxiiro@linux.com>
Signed-off-by: Anil Belur <askb23@gmail.com>
Signed-off-by: Thanh Ha <zxiiro@linux.com>
Signed-off-by: Anil Belur <askb23@gmail.com>
Took inspiration from my StackOverflow reply here
https://stackoverflow.com/questions/50177308 to document a practical
use of setting variable defaults and inheritenence.
Change-Id: I45934341d3ff3fbf4ff711a435924197d2f12712
Signed-off-by: Thanh Ha <zxiiro@linux.com>
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 <ssbarnea@redhat.com>
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
Allow views to also be configured via templates similar to
job-templates.
This adds a new project key called "views" and parser type called
"view-template" allowing the user to add custom views.
Example:
- view-template:
name: '{name}-template-{seq}'
description: 'testing view templates feature'
view-type: list
regex: 'test-view-.*'
- project:
name: 'test-view'
views:
- '{name}-template-{seq}'
seq:
- a
- b
- c
Change-Id: I6eb225f24bc3c7d790c7dcab6391735c579ac71a
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
This work was based on original work done by
Joshua Harlow on top of older code from:
https://github.com/abnamrocoesd/jenkins-job-builder/
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
patch.
Change-Id: If50a54d282dd7d901c16edb9fe04874bdd83c9ef
Co-Authored-By: Joshua Harlow <jxharlow@godaddy.com>
Co-Authored-By: Sorin Sbarnea <ssbarnea@redhat.com>
Co-Authored-By: Thanh Ha <zxiiro@linux.com>
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
Signed-off-by: Thanh Ha <zxiiro@linux.com>
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
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 <ssbarnea@redhat.com>
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 <askb23@gmail.com>
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 <thanh.ha@linuxfoundation.org>
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
Add project folder module. Jenkins folder could be made with project-type: folder
This requires Cloudbees folder plugin and python-jenkins folder update
(see: https://review.openstack.org/#/c/180185/)
Change-Id: I7e1c28c26a69ae6ca736cec88fcb957a716d8fad
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
jobs.
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
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
plugin_info_path.
See:
http://lists.openstack.org/pipermail/openstack-infra/2016-June/004388.html
Change-Id: I5a34979407d863a84f34afbf8f565081ec52190a
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Before, `jenkins-job-builder test -o outdir` would write
outdir/job_name
With the new option `--config-xml`, it writes
outdir/job_name/config.xml
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
Since introduction of the Jenkins Pipeline plugin
(https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin), one can
configure a Pipeline job using a Groovy file lying with the source code
(see: https://jenkins.io/solutions/pipeline/).
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
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
- 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 <brandon.leonard@rackspace.com>
Co-Authored-By: Joao Vale <jpvale@gmail.com>
Co-Authored-By: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
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 <rtagami@airstrip.jp>
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
checked.
Change-Id: I2316bc1b7e845c29a8b248eef4668a6099d109f7
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
descriptions.
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
The system-global path of
/etc/jenkins_jobs/jenkins_jobs.ini
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
~/.config/jenkins_jobs/jenkins_jobs.ini
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
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
usage.
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