Commit Graph

137 Commits

Author SHA1 Message Date
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
Vsevolod Fedorov e27358111d Add missing tests for some wrappers
Test for timeout plugin version before 1.14.
Test for obtaining timeout plugin version by plugin name "Build Timeout".
Test for nodejs-installator plugin, with nodejs version specified.

Change-Id: I87e304b5b45c957a36ae2a109a176bf70ae94136
2023-12-19 12:10:43 +03:00
Vsevolod Fedorov f4d64f9f66 Move tests to pytest
Pytest makes each scenario into individual selectable test.
To be able to run each scenario separately is very useful for development.

Change-Id: I4b1c990a1fd839ce327cd7faa27159a9b9632fed
2022-12-20 10:44:43 +03:00
Ken Dreyer 787164e09a wrappers: omit blank settings for ssh-user-private-key credential
For the ssh-user-private-key credential-wrapper, the "key-file-variable"
setting is mandatory, but the "username-variable" and
"passphrase-variable" settings are optional.

Prior to this commit, if a user omitted "username-variable" or
"passphrase-variable" settings, JJB would write empty
<usernameVariable/> or <passphraseVariable/> entries. When both were
empty, the credentials-binding plugin would crash with an error:

  IllegalArgumentException("Cannot use the same key in both secretValues and publicValues")

To resolve this, do not write XML entries for these optional parameters
when the user does not specify them.

Add a minimal test case reproducer.

Change-Id: I94a4437eee6a8fdaf655c1a3bf69d46844b225bc
2022-06-09 16:37:50 -04:00
Ken Dreyer ce865d4b9c wrappers: rename credentials-binding examples
Rename credentials-binding example files to have a dash to correspond to
the YAML key that users will use.

Add the prefix "-full" to indicate that these are full examples where a
user specifies every variable.

Change-Id: Iae52c037b213c8f5511244ba075063e6b1a1f43a
2022-06-09 16:04:33 -04:00
Adam Romanek 23e6f39287 Fix SSH Agent plugin markup for empty list of users
There are cases when you want SSH Agent plugin to just start and stop
an SSH agent during the build, without adding any keys automatically.
One of such cases is when you want to use an SSH key stored on a
SmartCard -like device, such as NitroKey HSM.

So far, when the "users" property was set to an empty list then the
output XML markup didn't contain the <credentialIds/> tag and the plugin
was then crashing with NullPointerException.

Also, when the "users" property was set to a list with just one value
then the output XML markup was always generated in the "old style"
format (matching plugin versions < 1.5, so like almost 8 years old).

With this change, when using the "users" property the markup is
generated based on the actual plugin version installed in Jenkins. More
importantly, the generated markup is now properly handled by the plugin,
no matter if the input is an empty list or a list with one or more
entries.

Finally, fixed the parent of the <ignoreMissing> tag, which was wrongly
put under <credentialIds> tag when generating the "new style" markup
(1.5+), while it should simply be a top-level tag, laying next to
<credentialIds>, as in the corresponding implementation class [1].
This means the "ignore-missing-credentials" property was broken when the
"users" property was set to a list with more than one entry and it's now
fixed.

[1] https://github.com/jenkinsci/ssh-agent-plugin/blob/ssh-agent-1.5/src/main/java/com/cloudbees/jenkins/plugins/sshagent/SSHAgentBuildWrapper.java#L83

Change-Id: Ife5a08739da9ea1130f0ea7daa08c16675f6c75d
2022-02-13 17:47:39 +01:00
Zuul 7c1c936478 Merge "Updated BuildTimeoutWrapper plugin" 2020-11-16 14:06:38 +00:00
Zuul 24b3b9c87b Merge "Update Build Name support" 2020-11-16 14:06:38 +00:00
Sagar Khushalani 7b805f9c0c Add missing vault-secrets options
This patch adds the following options that are missing from JJB
but available in the UI:

- fail if path not found
- skip ssl verification
- k/v engine version

Change-Id: Id8e14d63c668a1ef826ae88ae3ce0360609bde99
2020-10-13 07:51:16 -05:00
Eren ATAS 5768260ecc Update Build Name support
Added the missing tags, also added a test case.

Change-Id: Ic1cb6c3991afe7ef99dd448e6ba49d510f54bd59
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
2020-10-02 13:35:45 +02:00
Eren ATAS 6b3d7d806b Updated BuildTimeoutWrapper plugin
On version 1.17 of BuildTimeoutWrapper plugin, new option
called "AbortAndRestart" has been introduced. The plugin support
has been updated in order to support this option. A test case
also added.

Change-Id: I4bcbdbc45e177fc4d302baa68898e89463535f6f
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
2020-10-02 13:34:16 +02:00
Eren ATAS 2e84bdf5b6 Removed the unnecessary empty combinationFilter Tag
In the current implementation, jjb creates an empty
combinationFilter tag whenever there is `executionStrategy`.
This empty tag should not appear.

Change-Id: I2bf25ae58d12904ce0a00e0a5cfefbf27d9451ad
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
2020-07-07 11:32:51 +02:00
Igor Lakhtenkov 2eb74a15cd Added trim option for String parameter.
Task: #22637
Change-Id: Ic2722aac586d3911e3ff5ab4c2d3c5a7a03fa14e
2020-05-22 17:04:49 +03:00
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>
2019-09-09 19:23:24 +01:00
Sergii Kipot 38aa498df3 Add support of "disableDeferredWipeout" option to workspace cleanup plugin
Change-Id: I2edd0343966e1720161c291b811b989f005495fb
2019-08-14 20:50:06 +02:00
Andrey Kostrov 2bff652b03 Add `Specs support` for `artifactory_generic`
Add support of Artifactory Specs
https://www.jfrog.com/confluence/display/RTF/Using+File+Specs

As for now, JJB doesnt support of Artifactory Specs,
only deprecated way is supported.

This patch adds possibility for using of Specs inside Jenkins
plugin
https://www.jfrog.com/confluence/display/RTF/Jenkins+Artifactory+Plug-in
Change-Id: I69e64202972f9f9b9147fdd65daffc2734a7d0cd
2019-04-10 13:58:31 +03:00
Zuul 192286d700 Merge "docker-custom-build-env: Add support for new options" 2018-09-21 13:43:00 +00:00
tanhengyeow 55310657f0
docker-custom-build-env: Add support for new options
Change-Id: I9482d2e3c98cf8058d5689cd688b8cc489bbb016
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
Signed-off-by: Anil Belur <askb23@gmail.com>
2018-09-21 18:38:31 +05:30
Zuul ed468042ba Merge "config-file-provider: Add tests" 2018-09-21 11:38:36 +00:00
Zuul 6f412c8450 Merge "build-keeper: Add support for RunCondition" 2018-09-21 01:43:53 +00:00
Zuul c32bb73d70 Merge "artifactory-generic: Utilize convert_mapping_to_xml" 2018-09-16 17:50:14 +00:00
tanhengyeow b76d4da653 config-file-provider: Add tests
Change-Id: Id8e36d1745bd05527985d5ee9ddfba32c5fa197d
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-09-07 22:50:46 +08:00
tanhengyeow d30af4616a credentials-binding: Add support for more options
Change-Id: I0d193dbab5967b362d92bde58c5a43bacac86bd2
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-09-01 21:20:41 +08:00
tanhengyeow 854bec35af build-keeper: Add support for RunCondition
Change-Id: I05e7f9930c18e4cf803eb0d50dbd626bb081c915
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-08-27 22:26:40 +08:00
tanhengyeow 01dc48dcf7 artifactory-generic: Utilize convert_mapping_to_xml
Change-Id: I9add96bfb2e8d55cd9175465326660ab2144e944
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-08-25 01:15:38 +08:00
tanhengyeow 4cce3d6a78 ansicolor: Enforce valid types
Change-Id: Ie14dcfc289bc0a88da8071cb4e308a49afd47a2a
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-08-16 22:03:42 +08:00
tanhengyeow fada164a7d ssh-agent-credentials: Support ignore-missing-credentials param
Change-Id: I5f78648600ef045dfe539a950daae14b304a74d9
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-07-29 17:10:14 +08:00
Zuul 637676375a Merge "Normalize newlines at end of file" 2018-06-29 21:15:01 +00:00
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>
2018-06-29 16:07:06 -04:00
Roman Iuvshyn 465e860684 Adds wrapper for vault plugin
Change-Id: I85ab23670a1d89b04eba01ddd4cc024da1d879a9
Signed-off-by: Roman Iuvshyn <riuvshyn@redhat.com>
2018-06-28 13:29:34 +00:00
Zuul 4167c80d3d Merge "Add support for new option in config_file_provider_builder" 2018-06-21 17:35:52 +00:00
tanhengyeow 1f857fc816 Improve support for EnvInject plugin
Adds support for groovy script option and sandbox option.
Updated new example YAML and XML files.

Story: #2000922
Task: #3553

Change-Id: Iad44f9a0a776060c6fb1acfc3ebb44fa3c5acef2
2018-06-16 00:30:21 +08:00
Yolande Amate 843929143b Add support for new option in config_file_provider_builder
Change-Id: Iab4ab936a44868abd4e0dbf3033107c0cf33e312
Task: 4669
story: 2001062
2018-05-21 14:18:43 -04:00
Sorin Sbarnea 89b531613c
fixed config format for nodejs plugin
Updates generated config for nodejs
to match current configuration format.

Change-Id: Ie2642cc81d7dcf176c3d826120850dfaa1811150
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2018-04-28 10:15:07 +01:00
Inaky Perez-Gonzalez d66cd3e6da
wrappers: fix XML node name for scrip-env's only-run-on-parent
Jenkins configuration wants it as runOnlyOnParent (vs onlyRunOnParent).

https://storyboard.openstack.org/#!/story/2001547

Change-Id: Icbf9b44cabe6f111941659ec5b084d44c0fc8a59
2018-04-12 19:11:32 -04:00
Zuul ed07d8fa94 Merge "Fix timeout wrapper version detection" 2018-02-08 20:55:26 +00:00
Thomas Bechtold ecf3933dc2 Fix timeout wrapper version detection
If, for whatever reason, the version of the build-timeout
plugin can not be detected, assume that we use a newer version (>= 1.14).
Version 1.14 is already ~ 2 1/2 years old so this is a sane assumption.
Also adjust fixtures to use the newer plugin version xml output.

Change-Id: I86295933d0c3247f55d0114473fc9c8f8feb7441
Signed-off-by: Bertrand Roussel <broussel@sierrawireless.com>
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2018-01-09 09:02:29 -08:00
Sylvain Baubeau 3f3c3a1160
Add support for ghprb wrappers
Change-Id: Ia23cf5cd57a7db4492e2006257d0c62da3c95c07
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2017-11-08 09:12:45 -05:00
Zuul 45a10f9193 Merge "Adds support for prefix-variable in version-number wrapper" 2017-10-23 17:44:18 +00:00
Jenkins 7b1a71d882 Merge "Default artifactory-generic to newest plugin config format" 2017-09-20 00:43:09 +00:00
Jenkins f2b01f7c5c Merge "Update openstack to use convert_mapping_to_xml()" 2017-08-29 22:10:05 +00:00
Yolande Amate 828baa7d3e Update openstack to use convert_mapping_to_xml()
Change-Id: I29fdc553512f19c73aef88c42d72f8b5c3d9f003
2017-08-21 19:27:09 +01:00
OJ LaBoeuf c052a70837 Adds support for prefix-variable in version-number wrapper
prefix-variable is currently not available for use in the version-number wrapper.
updated wrapper for support of this variable
and updated test fixtures to also use this variable.

set default value of prefix-variable to ''
Errors out without a default value set saying the attribute is missing,
and since this is an optional attribute we don't want that.

Task: 4885
Change-Id: I151eef271194fb38dfde7518698f2ff06e3a8f01
2017-08-14 13:42:24 -07:00
Jenkins d4ec195645 Merge "Update custom_tools to use convert_to_xml()" 2017-08-03 04:58:32 +00:00
Thanh Ha 47ab1173e0
Default artifactory-generic to newest plugin config format
Change-Id: I3a1f6185a0a71bb1444ba3e45790ecfce559e9f5
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2017-07-26 15:58:26 -04:00
Yolande Amate 484446ddd0 Update custom_tools to use convert_to_xml()
Change-Id: I2a9c3a195c0999f8971b02bb691fd486015cfbed
2017-07-21 15:25:19 +01:00
Darragh Bailey 3e3002f351 Fix workspace cleanup code
Ensure separate pattern tag is created for each pattern to be added.
This ensures that failure to add a pattern to the yaml will not trigger
an exception either.

Story: 2001109
Change-Id: I77f2b467e1f9b37817f5d516744abac8475a71ef
2017-07-07 17:58:16 +01:00
Jenkins 4f77324fea Merge "Wrapper pre-scm-buildstep: added support for failOnError parameter" 2017-03-29 09:55:34 +00:00
Sandro Gattuso 12c2ca3396 Wrapper pre-scm-buildstep: added support for failOnError parameter
- Added failOnError argument for pre-scm-buildstep
- Introduced buildsteps argument and moved list of build steps to match xml configuration of the preSCMbuildstep plugin.
- Updated existing test cases to match the new argument structure
- Added test case for pre-scm-buildstep to verify creation of failOnError tag
- Added verification on version to maintain retro-compatibility
- Updated documentation to fetch example from testcase definition

Change-Id: I25c19cd0552cf2de97b9c391492d95779c1360be
Task: 3163
Story: 2000690
2017-03-28 17:10:29 +00:00
Jenkins fc7ede077a Merge "Add support for Sonar wrapper" 2016-10-21 11:31:29 +00:00