Commit Graph

2766 Commits

Author SHA1 Message Date
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
Vsevolod Fedorov 1a65a1d44b Handle nested brace inside variable
Change-Id: I1004ea869bfe56b380109c7bcae866931b4d4725
2023-11-22 11:15:51 +03:00
Vsevolod Fedorov 53bdf1ee7a Update documentation links
Apply URL redirections reported by tox docs-linkcheck output.

Change-Id: Id2f400414068c26d3103ca8fa564b7e9827f9f79
2023-11-09 12:24:34 +03:00
Aleksey Tsalolikhin 940a4b65be fix/2010888 Add default "current-parameters" value in "trigger-builds"
fix/2010888 Add documentation of default value for the "current-parameters" value in the "trigger-builds" builder.

Resolves https://storyboard.openstack.org/#!/story/2010888

Change-Id: Idab9dd0b3cf44b0756019e0e0d3f92f83c0b34b8
2023-08-18 23:04:54 +00:00
Vsevolod Fedorov d62faa15d4 Fix parameters overrides in dimensions specification
Task: 48621
Story: 2010883
Change-Id: Ia267f66c3832fb4a42a54a86bda259e96bb191fd
2023-08-16 11:54:18 +03:00
Vsevolod Fedorov 0f29e2ea3a Expand axis params before enumerating values
Change-Id: Ib51c00ae6a000f8c87483fcdc4433a2d0d055942
2023-07-04 11:41:05 +03:00
Oleg Stiplin 6d71ade6bd Add tokenCredentialId parameter support to generic-webhook-trigger
Change-Id: Ied3cbe3758967659f83637ccea78d834079a1470

Add tokenCredentialId parameter support to generic-webhook-trigger

Change-Id: Ied3cbe3758967659f83637ccea78d834079a1470
2023-06-13 13:18:45 +03:00
Vsevolod Fedorov 84fe78ad90 Fix macro call with null parameters
Change-Id: I48bfa50d4011068bcb0206456be1009c1f9fde54
2023-04-17 10:38:26 +03:00
Vsevolod Fedorov eebfb9c961 Do not fail on empty YAML file
Change-Id: Ia12862f902c2f0b638fcbff798553ca404d81e24
2023-04-12 11:22:20 +03:00
Vsevolod Fedorov 60e8395c62 Add source location and context to error messages
Change-Id: I2e955c01b71a195bb6ff8ba2bb6f3a64cb3e1f58
2023-04-04 13:35:42 +03:00
Vsevolod Fedorov 7db2d13937 Refactor ModuleRegistry.dispatch method
Extract _load_eps and _dispatch_macro methods.

Change-Id: I6c87229a16e0198f11d199c60f5cf1a5d46770fb
2023-04-03 11:50:55 +03:00
Zuul 589023d5c4 Merge "Added configuration for Suppress SCM Triggering" 2023-03-31 15:14:05 +00:00
Piotr Falkowski cd8c8bfbb7 Added configuration for Suppress SCM Triggering
In version 2.1045.v4ec3ed07b_e4f Branch API Plugin added options to
configure suppressing SCM trigger. Previously this feature could
be only turned on or off, now it's possible to select what to suppress
and on which branches.
(see https://github.com/jenkinsci/branch-api-plugin/pull/244)

This commit adds support for this option by allowing dictionary syntax
for `suppress-scm-triggering` element:
  ```
  - suppress-scm-triggering:
      suppression-strategy: suppress-branch-indexing
      branch-regex: ^.*test.*$
  ```
while preserving support for currently existing syntax:
  ```
  - suppress-scm-triggering: true
  ```

Change-Id: I5d0b32042fc07d674bf2f26e5b468f051077fb02
2023-03-30 13:17:39 +02:00
Ettore Leandro Tognoli d839dc7699 Add discord-notifier publisher
Plugin page: https://plugins.jenkins.io/discord-notifier/
Requested on: https://github.com/ettoreleandrotognoli/jjb-discord/issues/1

Change-Id: If34f0dec29af661d62f6b7b7110297fd1751ab8e
2023-03-29 17:27:25 -03:00
Zuul 6ac387cb31 Merge "STORY: 2010534 Fix bug: j2-yaml is not allowed inside macro body" 2023-03-02 08:52:31 +00:00
Zuul f3d42c2fbb Merge "Rewrite YAML parser" 2023-03-02 08:49:49 +00:00
Thomas Bechtold f0b52ec41a Fix --enabled-only option when updating jobs
Commit 5e61fbaf00 added a new --enabled-only option but that
doesn't work correctly because the xml_jobs_filtered variable isn't
filled with all the jobs in the end. So some jobs are not updated even
if the disabled status was not found. That's fixed now.

Change-Id: I915116cf875e9e20c10ca43175c924b9e4307cca
2023-03-01 12:50:47 +01:00
Vsevolod Fedorov a701920d7b STORY: 2010534 Fix bug: j2-yaml is not allowed inside macro body
Change-Id: I24916df5f0592a5ea8197e7f372bd37fdba3a461
2023-02-28 20:16:57 +03:00
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
2023-02-28 20:16:57 +03:00
Piotr Falkowski 5cea04aa2a New permissions option for GitHub PR Comment Build plugin
In version 78.v2dcf62ba199b GitHub Pull Request Comment Build Plugin
introduced permissions check for users triggering jobs with comments.
This added a new checkbox/XML element that allows untrusted users to
trigger builds.
(see https://github.com/jenkinsci/github-pr-comment-build-plugin/pull/46)

This commit adds support for this option by allowing dictionary syntax for GH PR Comment Build plugin:
 ```
 - trigger-build-on-pr-review:
    allow-untrusted-users: true
 ```
 while preserving support for currently existing syntax:
 ```
 - trigger-build-on-pr-review: true
 ```

Change-Id: I554129c779161b47cba4566f7821ef7590a242e0
2023-02-27 09:07:52 +01:00
Thomas Bechtold 5e61fbaf00 Add config option --enabled-only
That option can be used when calling the update subcommand. If the
option is set, only jobs which are enabled will be updated.
That is useful of there are a lot of disabled jobs which are not
required.

Change-Id: Ie2f268e2356a3b7e0a334a331696ca81e09790aa
2023-02-22 09:11:00 +01:00
Piotr Falkowski 695872835f Support for GitHub Checks plugin
Change-Id: I0dcf84a56a26f8cccbfdcc6fe60567a4120e78f9
2023-02-09 11:32:55 +00:00
Zuul f16a4292b5 Merge "Tests: Rename yamlparser tests and fixture directories" 2023-01-30 16:16:07 +00:00
Zuul e6ba6ecaf7 Merge "Add properties for Gitlab trigger" 2023-01-28 10:35:25 +00:00
Mateusz Rygiel 456e64513f Add properties for Gitlab trigger
Add source branch regex property for gitlab trigger
Add merge request label filtering options to gitlab trigger

Change-Id: Idbcec2952459b80b8b35133a1c4913ec195b5ff7
2023-01-27 16:26:38 +01:00