Commit Graph

216 Commits (master)

Author SHA1 Message Date
Vsevolod Fedorov af9e03ec08 Rewrite YAML parser
Rewrite YAML parser, YAML objects and parameters expansion logic to
enable better control over expansion logic.
Broken backward compatilibity:
* More agressive parameter expansion. This may lead to parameters
  expanded in places where they were not expanded before.
* Top-level elements, which is not known to parser (such as 'job',
  'view', 'project' etc), are now lead to parse failures.
  Prepend them with underscore to be ignored by parser.
* Files included using '!include-raw:' elements and having formatting in
  it's path ('lazy-loaded' in previous implementation) are now expanded
  too.
  Use '!include-raw-escape:' for them instead.
  See changes in these tests for examples:
    tests/yamlparser/job_fixtures/lazy-load-jobs-multi001.yaml
    tests/yamlparser/job_fixtures/lazy-load-jobs-multi002.yaml
    tests/yamlparser/job_fixtures/lazy-load-jobs001.yaml
* Parameters with template value using itself were substituted as is.
  For example: "timer: '{timer}'" was expanded to "{timer}". Now it
  leads to recursive parameter error.
  See changes in this test for example:
    tests/yamlparser/job_fixtures/parameter_name_reuse_default.*
    ->
    tests/yamlparser/error_fixtures/parameter_name_reuse_default.*
* When job group includes a job which was never declared, it was just
  ignored. Now it fails: job is missing.
  See changes in this test for example:
    tests/yamlparser/job_fixtures/job_group_includes_missing_job.*
    ->
    tests/yamlparser/error_fixtures/job_group_includes_missing_job.*

Change-Id: Ief4e515f065a1b9e0f74fe06d7e94fa77d69f273
3 months ago
Thomas Bechtold 7c5300459d doc: add current year to documentation
That way, it's clear that the doc is not from 2012 and feels
outdated.

Change-Id: I63029c7b100ddfe41cd1ac242d57d5f8a41515eb
3 months ago
Vsevolod Fedorov 6b92807cd7 Tests: Rename yamlparser tests and fixture directories
Rename fixtures directory to job_fixtures to prepare for adding view_fixtures
directory in the following commits.

Change-Id: Ic20997cae020b542ddc22bf444fa6b92fbcae064
4 months ago
Vsevolod Fedorov 09f5e0362c Update documentation, tox environment
Python 2.7 is no longer supported.

Change-Id: I35d9c24d493dea254a823cce528e9fc482d9f4cd
11 months ago
Zuul 1980ca2271 Merge "add list command reference" 1 year ago
Donghui Wang 72bddfedbb update pip install cmd when install jjb from source
Change-Id: I77d00710c0b99765204aa116e404585b3fd27e5f
1 year ago
Donghui Wang eca2e713a5 add list command reference
Change-Id: I8c55a4a9dd562da0f182891ab54f3e33070ba396
1 year ago
Zuul 6001ebc28f Merge "update the heading level of execution.rst" 1 year ago
wangdonghui 3c0d09e353 update the heading level of execution.rst
The heading level of 'Recursive Searching of Paths' and 'Excluding Paths' should be below 'Running'.

Change-Id: I9069b2c205e0dfc945855ea5d7bff02149e1cd51
1 year ago
Zuul 5e66a5fbea Merge "Bumping black to 22.3.0" 1 year ago
Eric Ball 930dd24dd2
Fix: Update sphinx version pin, fix warnings
Sphinx was pinned to >1.5.0 <=1.7.0 4 years ago. It is now on v4.4.0,
and we're seeing an incompatibility with the latest version of jinja2.

Along with updating the Sphinx version, this also includes fixes for
several warnings generated in the latest version:
  * Outdated docs due to the removal of the "parser" param from
    Base.get_xml
  * Class lookup issues
  * External links for which we have extlinks defined
  * Deprated PyModulelevel is replaced by PyFunction
  * sphinx.ext.autodoc.Documenter.get_doc signature changed

Signed-off-by: Eric Ball <eball@linuxfoundation.org>
Change-Id: Iba65fb724f098f3e4a0b20f2a183cb2ea3c450ea
1 year ago
Jiri Podivin 352b93d586 Bumping black to 22.3.0
Setting desired version of black to 22.3.0 prevents issues with
the click dependency described in the #1966879.

Introduction of black 22.3.0 forced style changes in following files:
- doc/source/conf.py
- jenkins_jobs/local_yaml.py
- tests/base.py

These changes do not modify behavior of the programs concerned.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I42a46f9ed31ea0f404d698eec73d30975e2e6f4c
1 year ago
Fatih Degirmenci 471483029e doc: Fix links to yaml spec
The links pointing to full example and anchor & aliases on
yaml website are no longer valid, causing failures for
docs-linkcheck. This change updates the links in the doc.

curl https://yaml.org/spec/1.2/#id2761803
<meta http-equiv="refresh" content="0; url=/spec/1.2.2/" />

curl https://yaml.org/spec/1.2/#id2765878
<meta http-equiv="refresh" content="0; url=/spec/1.2.2/" />

Change-Id: I1d57e9b414694e2dd8e0dca24ef2e6ea96cb35a0
2 years ago
Pat Long d352ed9656 Fix documentation links
Jenkins Wiki has been fully taken off line, so update the remaining
links to reference either the relevant plugin page or the github repo.

Add extlink target for repo in jenkinsci github org.

The sonatype-clm plugin seems to be more-or-less completely deprecated,
so update the description to indicate this and link to the
nexus-artifact-uploader plugin.

Update the jjb sphinx plugin so that it generates references for the
yamlfunctions.

Change-Id: If2241e751d01a60a8cb4cbaea5b3176aeb92eab4
Signed-off-by: Pat Long <pllong@arista.com>
2 years ago
Matthieu Baerts 71cbf4399e
doc: fix link to YAML spec
It looks like the YAML specifications are no longer available in:

  yaml.org/spec/1.2/spec.html

but in:

  yaml.org/spec/1.2/

See:

  $ curl https://yaml.org/spec/1.2/spec.html
  <meta http-equiv="refresh" content="0; url=https://yaml.org/spec/1.2/" />

Update these links to avoid errors reported by jjb-tox-docs-linkcheck.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Change-Id: Ie928adf2e4c321e900bfbf36c19ae34a3dc7311d
2 years ago
Eric Ball a833d1fde6
Feat: Add GitHub Organization job type
This adds a job type "githuborg", which creates multibranch pipelines
for all repos in the org that contain the specified Jenkinsfile.

Signed-off-by: Eric Ball <eball@linuxfoundation.org>
Change-Id: I148e2300f3b1ee148b51d25a2a805ed0b5a97862
2 years ago
John Fragoulis c4c49cd8da
Update docs to reflect query_plugins_info default
Commit 30d61a21e8 changed the default but
missed updating the documentation to mention that it is False by
default. This update resolves the documentation mismatch.

Change-Id: Ibe2c31d7e9ca0380efe0e6ef5014c05f1c42eae8
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
2 years ago
Jiri Tyr 0f9dd4e805 Adding view for the Delivery Pipeline Plugin
Change-Id: I8a9a71267562734b078b7260c79d299db7fb4e2b
Signed-off-by: Jiri Tyr <jiri.tyr@gmail.com>
3 years ago
Zuul a3dc53b381 Merge "Ignore py:obj warnings and fail on warnings" 3 years ago
Mattia Rizzolo d69208c0c4
Fix some typos in documentation
Change-Id: I67d82228bb37b8b4634c07e76a421964e227c3cb
Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
3 years ago
Thanh Ha c3ef26c1b0
Ignore py:obj warnings and fail on warnings
* Enables fail on warnings and enable nitpicky
* Consolidate string -> str for args

Change-Id: Id5c29d48813fd6f772816dc74c7c4e408097113d
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
3 years ago
Thanh Ha 197226c538
Fix links causing redirects
Some links have been permanently redirected to a new URL so
adjust the links to go directly to the new URL.

Change-Id: I900091f8bdc39aa5fd06eae04a9b18ef23add8f2
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
3 years ago
Thanh Ha ee706cbdf1
Update Jenkins wiki -> plugins URLs
The Jenkins Wiki page is deprecated and Jenkins community is expected
to migrate their documentation to plugins.jenkins.io URL. This patch
updates all publishers that have a relevant plugins.jenkins.io URL
documentation link.

Change-Id: I94448d04f2b28fbf3befde2e49c76d196e352d7e
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
3 years ago
Thanh Ha 7b00932d2c
Enable docs-linkcheck
This toxenv will allow us to flag URLs that no longer work. We
also switch from using old style setup.py build_sphinx to the
newer sphinx-build command.

Change-Id: I62f42918814fb6eea4876e0d22c6bccddf86a826
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
3 years ago
Jan Zerebecki 587740ec75 Support nested views
Change-Id: I13532a16efc6e970ab5a7c021ec4d77be98d3de8
4 years ago
Thanh Ha 4d90c187a9 Auto-generated output from python-black
Please review the following patch containing the code changes in
the repo. This patch is a transition patch and is the auto-generated
output of the python-black tool.

Change-Id: I2d2de71da8a105fb62b561899ae78441ddab4032
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
4 years ago
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/conf.py extensions to allow for
running `make doctest` locally.

Change-Id: Icd143fe25b1e2d5c8d1e7e8b0650d91f40838043
Signed-off-by: sbussetti <steve.bussetti@gmail.com>
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
means.

Change-Id: I4f5629c3ee8031d41054e3be5e853201d8f0fed6
Signed-off-by: sbussetti <steve.bussetti@gmail.com>
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 <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>
5 years ago
Thanh Ha ce040d8ad6
Document practical use case for variable defaults
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>
5 years ago
Sorin Sbarnea 4953756c27
adopt pre-commit hooks
Change-Id: I98bc0b5717c3921b35e74f53c55f896427880a84
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
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 <ssbarnea@redhat.com>
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 <zxiiro@linux.com>
5 years ago
Thanh Ha 418e7c628d Add support for view-templates
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>
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:
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>
5 years ago
Major Hayden 14f7bbcc3b
[Docs] Ensure commands are monospaced
Change-Id: Iee9f8c8831ee83ea23677fdbdd20eb2ae7709d29
Signed-off-by: Major Hayden <major@mhtx.net>
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 <ssbarnea@redhat.com>
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 <askb23@gmail.com>
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 <thanh.ha@linuxfoundation.org>
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