2790 Commits

Author SHA1 Message Date
Johannes Carlsson
18ec0ba6af Add support for "prune-tags" in git scm
"prune-tags" removes tags from the local workspace before fetch if
they no longer exist on the remote. Support for this was added
to the git plugin in JENKINS-40529.

Change-Id: I204fd0a508944fecba8a3a26527793cdf37234f8
2025-04-01 09:59:37 +02:00
Michal Szelag
2a907c9ab0 Add support for build trigger using PR label.
Story: https://storyboard.openstack.org/#!/story/2011138

The feature is supported by GitHub PR Comment Build Plugin.  The change extends
property strategy configuration with a label regex parameter that triggers a job.
The job configuration is only supported by trusted users that have write access
to the repository.

Change-Id: Ib6910c6ebb78801710e334503a4545f08498ed0b
2025-03-04 01:52:57 +00:00
Dan Mick
60f0316389 scm: add support for hudson.plugins.git.util.AncestryBuildChooser
Adds a new scm.git choosing-strategy 'ancestry', corresponding to
AncestryBuildChooser, and two new options if that strategy is
selected, maximum-age and ancestor-sha1.

Includes doc and test updates.

Change-Id: Ib94f6100d4891b4196a6326c0678f638b4edbeab
Signed-off-by: Dan Mick <danmick@gmail.com>
2025-02-11 20:56:54 -08:00
John Gravatt
6fc0a3ba25 Update "Delivery Pipeline View" to accept 2 additional parameters. They are "embedded-css" and "full-screen-css" which are part of the Jenkins plugin.
Change-Id: I1a8ea098cbab1a672fe9b1653da2530ad87b2aad
2025-01-17 14:43:57 -06:00
Johannes Carlsson
50dd589966 Fix "abort-builds" for WorkflowMultiBranchProject
"abort-builds" must be present in job_contents_keys in order for it to
properly work.

Also add a multibranch test for the yamlparser that will verify that
this works properly.

Change-Id: Ide9cd0f89a19002977cdcc2dfb9cd873e7d16945
2024-11-19 11:30:35 +01:00
Christoph Erhardt
7bf0dacd80 Fix the build with setuptools >= 71
The `pkg_resources` module no longer bundles a vendored version of the
`packaging` module. Add an explicit dependency on `packaging` and
directly use its classes.

Change-Id: I9362ca6d6323b56bc579db30e7f5bb40b57da65a
2024-11-09 07:48:40 +01:00
Chris Cheng
7712c0b7ee allow disabled to remain the last setting
In the latest version of Jenkins, the default value of 'disabled' is
true. When 'disabled' is not set (or None), reconfig_job will activate
the job, but in some cases we hope that 'disabled' remain the last
setting.
When 'disabled' is not set (or None) in yaml, and the job exists,
fix_disabled will try to get 'disabled' from the jenkins server. So the
'disabled' value should match the current value on the jenkins server.

Change-Id: Icd840f15c4d48cd8a8ebc0f891beac68c2bb6bdd
2024-10-30 17:19:06 +00:00
Vsevolod Fedorov
643a58e255 Fix zuul checks
Fix docs and docs-linkcheck tox targets:
It looks like recently sphinx began to check if footnotes are
referenced. If not, it issues a warning which is treated as error.

Fix Python 3.10 and 3.11:
It looks like opendev switched to Noble Ubuntu release.
Pin these versions to previous one.

Shift flake8 version.
New version ignores syntax whithin strings.

Fix formatting errors reported by flake8.

Change-Id: I9b23cccf0dc83fb56083b5fe8c9c026f5dff7e9a
2024-10-30 18:03:35 +03:00
Max Trunov
b500b95c56 STORY-2011206: add inheritance strategy
Change-Id: Iadc5cfd2fe920be0b6e985bb2f19e4e5bab8929e
2024-08-16 16:44:30 +05:00
Ankush Pathak
f2f3325f5a Revert "allow disabled to remain the last setting"
This reverts commit 8bffa4d520edd1559d25c0fc7e2635f60e504d56.
8bffa4d520edd1559d25c0fc7e2635f60e504d56 introduced a bug where new jobs
without a `disabled` value configured in their source would fail to be
created on Jenkins.
Reverting 8bffa4d520edd1559d25c0fc7e2635f60e504d56 for now while the bug
is addressed and sufficient test cases created to catch such a
regression.

Change-Id: Ia8adc1f8394b6a745e8bbc7038c85958c56fd11b
2024-07-10 09:21:55 -05:00
Zuul
6bb50811b4 Merge "Add job_builder option to load extra modules for jinja2 filters" 2024-07-05 12:03:18 +00:00
Kienan Stewart
7a628d3737 Add job_builder option to load extra modules for jinja2 filters
Change-Id: Ie6ec481f7ebefc536fc152ef68f73bdc618c54a1
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
2024-07-04 10:31:08 -04:00
Chris Cheng
8bffa4d520 allow disabled to remain the last setting
Change-Id: I5a31a38c8fd50b5bf8d952ad7bab38a535895ed5
2024-07-04 11:57:06 +00:00
Ankush Pathak
ed2c37304c * feat: Cache raw YAML parsing results of files
It is expensive to read and parse an YAML file. This commit optimizes
for usecases where YAML files are reused across any input by caching the
raw parsing result.

* Pin setuptools version to 69.5.1 for Python >= 3.8
A change introduced in setuptools version 70.0.0 causes tests under
test_moduleregistry.py to fail with "InvalidVersion". Pin the setuptools
version for Python >= 3.8 until this is investigated and resolved.

Change-Id: I534d7a6d9992780cd8de4f8460190caf5c3bde12
2024-07-03 17:24:38 -05:00
Victor Seva
0c012177d3 fix expansion on {obj:key} variable on includes
* '{name}' param should be expanded first
* already expanded params should be reused

Change-Id: Iedc384932a6e72aebfa87da141812934e0625c03
2024-06-01 17:36:05 +00:00
Vsevolod Fedorov
1ecedbbe68 Add labels to lauch build property for gitlab trigger
Change-Id: Id5f965d5fd5f81531401d4727fd5c3d33a5d3b5b
2024-06-01 17:08:10 +00:00
Luca Weiss
2b166cff8a Add support for clean-first parameter of repo scm
The repo plugin supports 'cleanFirst' since plugin v1.11.0

  9c7e81cbf0

Add support inside jenkins-job-builder to set that value.

Change-Id: Ifae1bad0f0fb4a56fc0f030038eefbcc8cd4ad6f
2024-06-01 16:40:40 +00:00
Vsevolod Fedorov
667402cc83 Fix links to nexus platform plugin
It is no longer distributed by the Jenkins project due to its license terms.

Change-Id: Iadfd6d5db3df2d611bae96df01ee65d5caf17c1a
2024-06-01 18:42:56 +03:00
Stephen Boyd
06fab3c38a
githuborg: Support ignoring archived repositories in an organization
Change-Id: Icb3591882e29a92819794e9bdcdc2c2f9f617016
2024-05-20 14:41:26 -07:00
Stephen Boyd
f62ec53e82
githuborg: Pull build strategies into parent xml
Either Jenkins seems to have made an update where the build strategy
properties have been moved, or this never worked. When generating the
XML using the Jenkins UI, the build strategies appear at the top level.
Prior to this patch, when using jjb, the configuration was completely
ignored, causing some charming build storms.

Breaking change: The legacy github org output is no longer correct.

Change-Id: Idb5bf025f9bcbf9d9588465713ea5a29ff069e6d
2024-05-14 17:39:42 -07:00
Victor Seva
4897d5e047 Story 2011112: include-raw-verbatim fails on job-template
don't expand IncludeRawVerbatim twice

> FAILED tests/loader/test_loader.py::test_include_job[include002] - jenkins_jobs.errors.JenkinsJobsException: While formatting string "#!/bin/bash\n#\n# sample script to check that variables aren't expanded\n# when usi...": Missing parameter: 'VAR1'
> FAILED tests/loader/test_loader.py::test_include[include002] - jenkins_jobs.errors.JenkinsJobsException: While formatting string "#!/bin/bash\n#\n# sample script to check that variables aren't expanded\n# when usi...": Missing parameter: 'VAR1'

Change-Id: I88b22987eabe99f00d99755299256d4aba8a1c76
2024-05-08 06:22:28 +00:00
Stephen Boyd
e9838cd327 Support for filtering repositories in GitHub Organizations
Change-Id: I7758cf89bbaac6942bb7d8fc697f83b1b6466637
2024-05-07 10:37:00 +00:00
Thomas Bechtold
c5fce78f71 Story 2011116: recursively find jinja2 vars from templates
Don't only try to find undeclared variables from the current template
but also recursively find undeclared variables from included and
imported jinja2 templates.
Otherwise included/imported templates with variables can not be used.

Change-Id: Iebdce1accf74f27901d80a41c85624ba819bf2a8
2024-05-07 07:05:19 +02:00
Thomas Bechtold
770a4bbb4a Fix _pseudo_parse_arglist from Sphinx
sphinx.domain.python got split[0] into multiple modules so make the
sphinx extension work with older and newer Sphinx versions.

[0]
e9dcfebcf9

Change-Id: I2dfb085cd382e277562f4dcb3d903729dc388fd4
2024-05-07 07:03:51 +02:00
Vsevolod Fedorov
1ead727a2d Story 2011049: Add --force flag to update-all command
Without it, using this command in scripts is impossible.

Change-Id: Ifd44fe0171a7753c9a09e9b05047ce2965c183f3
2024-03-25 13:08:25 +03:00
Vsevolod Fedorov
eb08e60765 Story 2011049: Delete also old views when --delete-old option is specified
Improve 'update' command to handle old views also, not just jobs.

Task: 49601

Change-Id: I60431f662d5a69c084b2698d08104a1524d02767
2024-03-25 12:47:40 +03:00
Vsevolod Fedorov
1f320ad9f9 Do not delete unmanaged jobs when --views-only option specified
Change-Id: I54e4d62db56824bfa020bbc1a711b95a5b15fcc5
2024-03-25 12:20:43 +03:00
Vsevolod Fedorov
2aa0ac5462 Refactor 'update' cli command
Change-Id: I4b253c30ed517bba38979b759082b37879af393e
2024-03-25 11:34:06 +03:00
Vsevolod Fedorov
e5f77255a2 Macro now can define defaults for parameters
Change-Id: Idc6688a76b80b904d24ff537a3df514b6d24b700
2024-03-19 11:44:08 +03:00
Vsevolod Fedorov
0cc475f765 Fix axis expansion error message
Change-Id: Ic5cfe925b600521cd3e1893e0340b9848ac1d798
2024-03-19 11:39:37 +03:00
Vsevolod Fedorov
bb4fab9192 Improve macro name in error messages
Change-Id: Ib31b7953c22b3fbc23adda889aa3ff980313ec8c
2024-03-19 11:39:37 +03:00
Vsevolod Fedorov
fb913725e2 Macro now use parameters from defaults
Also fix error message for missing defaults.

Change-Id: I5d912c2bfb607c8388010ac6e39780be93073f5a
2024-03-19 11:39:37 +03:00
Vsevolod Fedorov
14804154e4 Minor refactoring, cleanup: Remove unused 'eps' parameter
Change-Id: I63a612ed6a72b2934107696c701b828ccabadb3f
2024-03-14 12:47:25 +03:00
Vsevolod Fedorov
36b9d8bfca Add tags: '!include-raw-verbatim:' and '!include-raw-expand:'
Use '!include-raw-expand:' instead of '!include-raw:'
and '!include-raw-verbatim:' instead of '!include-raw-escape:'.
Tags '!include-raw:' and '!include-raw-escape:' are now deprecated.

Change-Id: I3cc5ab9f73d03de1ba09cbc4568366a3bb464a08
2024-02-07 14:22:54 +03:00
Vsevolod Fedorov
3cf741985f Use 'warnings' module for tag deprecation. Improve tests
Change-Id: Iae70789ba5948eb1ea259b6456dd0ba262c4eee3
2024-02-07 14:22:54 +03:00
Vsevolod Fedorov
9e05f9bcba Fix link in yaml_objects module docs
Change-Id: I55f9e6aecda99d97c69d0207994d2d5b568a4c4b
2024-02-06 11:45:22 +03:00
Zuul
b7a6b29056 Merge "Update TAP publisher plugin" 2024-01-30 07:03:43 +00:00
Kienan Stewart
804fcf903e Update TAP publisher plugin
Add support for the following configuration options:

 - stripSingleParents
 - flattentTapResult
 - skipIfBuildNotOk
 - removeYamlIfCorrupted

Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Change-Id: I387e5cd46fadb54e478627346dc6b4223bda1fc0
2024-01-24 11:15:24 -05:00
Vsevolod Fedorov
b669001eaa Merge global defaults for jobs also
Currently, global defaults are merged to custom defaults for job
templates, but not for jobs.
Unify this behaviour.

Change-Id: I26fb2678df7f4225571bf7c3cd4be7041ce99217
2024-01-19 12:31:42 +03:00
Vsevolod Fedorov
18efe5066b Unify variable and tags expansion inside jobs and macros
Expand variables inside macros without parameters and jobs
the same way as they are expanded inside macros with parameters
and job templates.
Make tags behave inside macros without parameters and jobs
the same way as they are expanded inside macros with parameters
and job templates.
Update or fix affected tests.

Story: 2010588
Story: 2010963
Story: 2010535
Task: 47394
Task: 49069
Task: 47151

Change-Id: Ie05ae6aa386c62ebbf68dd3e2c7001a4e444a47a
2024-01-19 12:31:42 +03:00
Vsevolod Fedorov
67645a46eb Fix legacy plugin version comparison; Remove cap on setuptools version
LegacyVersion class is removed from newer setuptools package. But
support for legacy versions is added in python-jenkins 1.8.2.
Switch to that implementation.

Fix broken plugin version comparison for legacy versions.

Assume latest plugin version if no plugin version is found.

Story: 2010990
Story: 2009943
Story: 2009819
Story: 2010842
Task: 49236
Task: 44852
Task: 44396
Task: 48448

Change-Id: Id7f0be1c42357454bd9bedcdee3fefb174943d81
2023-12-19 12:10:43 +03:00
Vsevolod Fedorov
e2cf69b4f4 Fix support for obsolete format of pre-scm-buildstep
'pre-scm-buildstep' wrapper has two modes:
1. Older: no 'buildsteps' element is specified. Build steps is a list under
   wrapper name. For example:

    - pre-scm-buildstep:
      - shell: echo hello
      - shell: echo bye

2. Newer: build steps specified inside 'buildsteps' mapping element:

    - pre-scm-buildsteps:
        buildsteps:
        - shell: echo hello
        - shell: echo bye

But, when 'preSCMbuildstep' plugin version is equal or higher 0.3, and first
mode is used, it fails.

Fix that.

Change-Id: I010d9f6c5e06ccd8c2723026aae2c60f79917ff4
2023-12-19 12:10:43 +03:00
Michal Szelag
429118b487 Fixing ignore-tags-newer-than inverted with ignore-tags-older-than.
Also fix test Scenario name.

Story: 2004614
Task: 28518

Change-Id: I0d0f633ffa4d10f4d1491589dc9da69ae9d3f463
2023-12-17 13:10:49 +03:00
Vsevolod Fedorov
d741ea02c6 Task: 47875
Story: 2010711
Search for included files relative to the current job first

Change-Id: I34a5743967bf7cbb8b464a0a36abad24180d61e4
Signed-off-by: Max Trunov <trunov_ms@taximaxim.ru>
2023-12-07 11:05:12 +03:00
Vsevolod Fedorov
af9e394c8e Add Loader.source_dir attribute
Currently, Loader.source_path is used for both error locations and
as base for include directory.
But, it is set to "<expanded j2-yaml>" by !j2-yaml: tag, which makes it
unusable as base for include directory.
Make separate source_dir attribute for this usage.

Change-Id: I67669eb42f761e2d76e89992e6ad89480ddd3df0
2023-12-06 12:37:22 +03:00
Vsevolod Fedorov
c1ac0e03d6 Story: 2010984 Fix folder tests and defaults for folders
Folders was not actually tested by tests. Fix tests and add more tests.
Fix bug in code unearthed by now-working tests: defaults were not checked
for job folders.

Task: 49188

Change-Id: I922af7a28b0ec0c99ef3f8a17b3d5a9c10f2dce0
2023-12-04 10:51:55 +03:00
Zuul
5aeecef649 Merge "Update documentation links" 2023-11-23 10:19:08 +00:00
Vsevolod Fedorov
a1d4f91d1a Add context for macro calls
Change-Id: I674b153770297c3a0abbfcee26d840e0f2be490b
2023-11-22 12:58:37 +03:00
Vsevolod Fedorov
d17820a405 Restore macros support for notifications
Bugfix. Notifications was forgotten when making list of available
modules for macros.

Change-Id: Ic79cdb34070bc82105a76896749b12047872e2f3
2023-11-22 11:33:49 +03:00
Vsevolod Fedorov
a82fa9d392 Update documentation for lazy-loaded files
Now, when tag !include-raw: has variable in included file path,
included file is expanded.
And lazy-loading mechanics is removed - now it can be expanded in
the usual way.

Change-Id: I7234d42793a080e7f4186707c4d1d2e9404bd7f3
2023-11-22 11:15:51 +03:00