Commit Graph

56 Commits

Author SHA1 Message Date
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
Igor Lakhtenkov 2e988b3f26 Added support of json type for extended choice parameter and related parameters.
Added support of multilevel type for extended choice parameter
dded jenkins_jobs.modules.helpers.check_mutual_exclusive_data_args decorator that used for validating data arguments
in jenkins_jobs.modules.parameters.extended_choice_param method.

Change-Id: Id8c0f8090dd99022501558cafa5b1c27e6675425
Task: #41320
2021-01-04 12:36:24 +03:00
Thanh Ha 5a98ebb8bb
Fix flake8 BLK100 and BLK999 issues
Resolves flake8 BLK related issues.

"BLK100 Black would make changes."
"BLK999 Unexpected exception: ..."

Change-Id: Ic6d4265e3d02b2f2a15ab851eaed98288c62730c
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
2020-08-31 10:54:19 -04:00
Eren ATAS 15ee9899b8 Added property-multiline for parameterized build trigger plugin
Updated test cases as well, The tag has been introduced after 2.35.2
therefore the parameter is also >=2.35.2

Change-Id: Ie0801108a16969b420b341e2deaa6ba62deb116c
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
2020-07-31 14:12:00 +02:00
David Aguilar 52caa12068 publishers: refactor out a helpers.trigger_threshold() helper
Change-Id: Ic698dc7a5f0952e5a7a4fef3350959b3d4f72d45
Signed-off-by: David Aguilar <davvid@gmail.com>
2020-06-23 23:35:05 -07: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
Mykola Nikishov bc55a673a0 Do not ignore global-settings-type in Maven module
settings-type parameter hides global-settings-type and makes it
impossible to use settings from the file and ConfigFileProvider at the
same time like:

    maven:
      settings-type: file
      settings: mvn/settings.xml
      global-settings-type: cfp
      global-settings: test

Change-Id: Ieda05912ae8b28942d98150a51c92b2521f2b6bf
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2019-01-04 23:58:20 +02:00
tanhengyeow 04a16a0ded copyartifact-build-selector: Utilize convert_mapping_to_xml
Change-Id: Ie66cff0f9cd775f963c2b7bd0cc1a759bf12fc93
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-09-06 23:03:48 +08:00
tanhengyeow 0616341e31 Fix typo of function description in helpers.py
Corrected the typo of function description in convert_mapping_to_xml.

Change-Id: I368196e21ada21c6fdbac29a9f3141d0b719e872
2018-07-08 11:35:34 +08:00
Zuul 4167c80d3d Merge "Add support for new option in config_file_provider_builder" 2018-06-21 17:35:52 +00:00
Kien Ha 1799211e3e Change default on fail_required parameter to True for convert xml
If optional setting was set and then is removed, Jenkins will retain the last
configured setting for the option. This is inconsistent as it is expected that
Jenkins will revert back to its default setting. And so optional parameters
should use default setting. That is, JJB will handle default setting if
optional parameter is not set.

Original issue:
http://lists.openstack.org/pipermail/openstack-infra/2016-February/003746.html

Change-Id: Iaf8684053f8a2a035467f13d91fe2f0a56be5906
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2018-06-04 19:19:06 -04: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
Zuul ec3de63dab Merge "Update cloudformation_stack to use convert_xml()" 2017-10-23 18:14:43 +00:00
Darragh Bailey d62fcc8ca4 Switch param order from yaml conf to plugin specific
Migrate from a global config __future__ to control behaviour to plugin
specific options to decide on whether to take the param order from yaml
when using the trigger-parameterized-builds plugin or when plugins are
making use of it as well.

Adjust the config retrieval to support a default value to simplify
logic around ensuring the behaviour matches 'true' by default.

Remove some redundant logic in helper module handling a default value
lookup and add some additional conf files to continue having some tests
using the old behaviour.

Remove old conf files setting the __futures__.param_order_from_yaml to
true as this is now the default under the correct plugin setting.

Change-Id: Ibd5f549b6d626bacaaa4221015a70aaf03626b00
2017-09-22 16:34:16 +01:00
Yolande Amate 76e0319c50 Update cloudformation_stack to use convert_xml()
Change-Id: I427899e6b540a918a3993b3b0af0b4c464f0e156
2017-08-11 23:49:49 +01:00
Yolande Amate b9603c1eea Update trigger_project to use convert_mapping_to_xml()
Change-Id: I4579a7609468fe8e789e59d4507bde2681bc0524
2017-07-08 00:18:18 +01:00
Darragh Bailey 91ae576e6a Consolidate pipeline and trigger-parameterized-builds
Move main behaviour of trigger-parameterized-builds to helper methods
and rework pipeline to utilize.

Change pipeline to respect param ordering from yaml by based on the
same option as defined for trigger-parameterized-builds.

Change-Id: I42fdf4fe7fd41c9b6560a1ef57e7f150380180d5
2017-06-20 18:33:06 +01:00
Jenkins bd0c1f33b8 Merge "Update artifactory_repository to make use of convert_mapping_to_xml" 2017-06-10 18:08:20 +00:00
Yolande Amate f7ae5fecb8 Update artifactory_common_details to make use of convert_mapping_to_xml
Change-Id: I02657f98345414cbccab45d0b866ebcfed2fd0f9
2017-06-09 23:57:18 +01:00
Yolande Amate dffd98a03a Update artifactory_repository to make use of convert_mapping_to_xml
Change-Id: I46b77626a9d1fc619314871f084204188a62cd43
2017-06-07 20:27:22 +01:00
Ari LiVigni 1979a954d1 Add support for jms_messaging builder and publisher
- Added the following for builder and publisher
- Added all the fields for JMS Messaging plugins
- Added a minimal example
- Added a full example
- Added info in trigger for builder description of the plugin

Change-Id: Ifa209978dd38692da9f9d06bdf34782bd684a324
2017-05-22 13:30:26 -04:00
Thanh Ha b093fee501
Add convenience function for plugin namespace
Plugins can use get_plugin_config() which will search in a plugin
namespace. For example:

[plugin "hipchat"]
authtoken = 123token

- Updated hipchat plugin to use get_plugin_config()
- Updated stash plugin to use get_plugin_config()
- Backwards compatibility is kept by falling back to the old
  configuration setting if the new one is not found.
- Warning is displayed if the old configuration method is used.

Change-Id: I7cff063e2d179a5d9a3f221c85de6864382bc477
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2016-11-11 13:34:16 -05:00
Jenkins 08677de43d Merge "Update TestFairy plugin" 2016-10-21 11:03:59 +00:00
Jenkins c1ae63ba91 Merge "Update helpers.artifactory" 2016-10-21 11:00:42 +00:00
Wayne Warren ae1fb60f16
Disentangle YamlParser and ModuleRegistry classes
Create the ModuleRegistry anywhere other than inside the YamlParser
class. This will make it slightly easier to factor a XmlGenerator out
of YamlParser, but I also want to work toward eliminating the circular
references between YamlParser and ModuleRegistry which have been
making it difficult to understand overall program flow.

This commit also replaces all YamlParser instances being passed to
Jenkins job config generating functions with a ModuleRegistry. Mostly
it seems like the parser was only needed to call the ModuleRegistry's
'dispatch' method which to be honest I don't fully understand. This is
where the circular references mentioned in previously come in...it
seems like the "dispatch" function needs access to the (mostly) raw
data contained by the parser, so it took that as a parameter.

The need for the YamlParser's job data can be satisfied by assigning
it to a property on the ModuleRegistry object before Yaml expansion or
XML generation begins; by doing this, we allow the ModuleRegistry to
avoid referencing the parser.

Change-Id: I4b571299b81e708540392ad963163fe092acf1d9
2016-08-18 22:42:24 -04:00
Jenkins 840cba77e7 Merge "Update findbugs_settings to use convert xml" 2016-08-18 16:17:10 +00:00
Jenkins c3c91e8d7d Merge "Update cfp builder to use convert xml" 2016-08-18 16:16:54 +00:00
Jenkins 2f366e632a Merge "Add valid_dict parameter to convert xml" 2016-08-18 15:30:45 +00:00
Kien Ha d27b7cf6dd Update helpers.artifactory
- Update helpers.artifactory_optional_props to use convert xml

Change-Id: Ib6ea675121a2cddd8e7df357b9b7855c41758529
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-08-09 22:51:42 -04:00
Kien Ha 8ead99e91b Update findbugs_settings to use convert xml
Change-Id: I01338e8efe34dfe473fc8eb358f94a421adb446c
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-08-09 20:30:03 -04:00
Kien Ha fcd7c80252 Update cfp builder to use convert xml
- Update helpers.config_file_provider to use convert mapping to xml

Change-Id: I35859653b653347049e72c9e1bf09ce9764aaca2
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-08-09 20:12:47 -04:00
Kien Ha 9c42d559d6 Add valid_dict parameter to convert xml
valid_dict provides a way to set options through their key and value.
This allows users to set options using more conventional naming
schemes/values but the resulting XML will use the corresponding value
from the dict for that key.

Change-Id: I6574a5f33eecddb9b7927841f08600f3977f0ca6
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-07-25 12:04:17 -04:00
Wayne Warren 4f04de1f9a Use JJBConfig in YamlParser.
This commit sees JJBConfig start to take the form it ought to have,
namely using attributes to represent different logical sections of
configuration that target specific subsystems of JJB.

It also moves ConfigParser data retrieval from
jenkins_jobs.modules.helpers.get_value_from_yaml_or_config_file() to
jenkins_jobs.config.JJBConfig.get_module_config()

TODO: Add JJBConfig tests to validate the behavior of JJBConfig in
specific circumstances.

Change-Id: I053d165559f5325a2f40b239117a86e6d0f3ef37
2016-07-22 17:33:25 +01:00
Kien Ha 2118dff694 Update TestFairy plugin
- Update documentation
- Add valid options to max-duration, screenshot-interval, and
  video-quality
- Test max-duration, screenshot-interval, and video-quality options

Change-Id: If010e7bc79e269b766107a5b2e57b9916ca8637d
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-07-11 15:01:32 -04:00
Kien Ha e237d7eb74 Add valid set of options parameters to convert_xml
Valid options provides a way to check if the value the user input is
from a list of available options.

Change-Id: I22409602fb526a83c0525772d68da1dbd28dd11b
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-07-07 15:04:17 -04:00
Jenkins d2e8b52f21 Merge "Add support for testfairy plugin" 2016-06-15 13:44:01 +00:00
Ari LiVigni 8df564f97c Adds support multijob support to the CopyArtifact plugin
Added the multijob-build keyword support to
CopyArtifact helper and builder

Change-Id: Id657ef072c049fa48d0e0a88bf3dec1a593f67d5
2016-06-01 21:51:20 -04:00
Kien Ha 17bf636afa Add support for testfairy plugin
Change-Id: I09226dc3bee88b4c1ecb6649ff7b971fce2541c7
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-05-13 11:13:53 -04:00
Jenkins 2721691960 Merge "Add support for OWASP Dependency-Check Plugin" 2016-04-30 11:29:54 +00:00
Christoffer Skeppstedt 50bc586ec5 Serialize combine-queued-commits for git-revision
When configuring the trigger_builds Builder in the Jenkins web
interface, you can add the parameter "Pass-through Git Commit that was
built". You could not configure this in a jobs.yml.

This commit adds that functionality (both to the builder
"trigger_builds " and the publisher "trigger_parameterized_builds").

I still want to be backwards compatible with the old version
(true/false) and maintain the similarity with the svn-revision param.
Which means that you can either configure it as

  git-revision: true/false

  or

  git-revision:
    combine-queued-commits: true/false

There were no prior case of shared code between builders and
publishers, so (by recommendation) I put the common logic in
builders.py, and then imported it in publishers.py.

I added thorough tests for the feature in the builders fixtures,
and only a basic test in the publishers fixtures, as suggested.

Change-Id: I72cdcae3fac1094ffcc9367369556b8bcbe2d5d7
2016-04-25 19:04:11 +01:00
Dawid Malinowski b4ba8e21cd Add support for OWASP Dependency-Check Plugin
Supports publisher for Dependency-Check utility that identifies project
dependencies and checks if there are any known, publicly disclosed,
vulnerabilities.
https://wiki.jenkins-ci.org/display/JENKINS/OWASP+Dependency-Check+Plugin

Change-Id: I3dc1ab923c392aac00189c3f852a1138c1f0ab36
2016-04-23 16:21:17 +01:00
Thanh Ha 5cdbb719af
Fix CFP configuration for >=2.10.0
In CFP plugin version >=2.10.0 the JJB code completely breaks for Maven
settings due to the new support for freeform cfp id names. We can detect
a old style name simply by reading the starting of the name and setting
it to set settings_type=cfp to maintain support for the old versions of
this plugin. Otherwise the default settings_type will fall back to 'file'.

Users using cfp will now need to set 'settings-type: cfp' in their YAML
files if they need to pull in CFP settings. All other settings file
configuration will work as it did in the past.

Change-Id: I650d485de6ecc1d2ef8fad6580c0c315fadde168
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2016-04-22 09:08:59 -04:00
Kien Ha 5fe547b0b6
Add helper function to convert xml
Change-Id: I435008aab406c9086d634781c03bb7cf5bc2acba
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-02-25 16:04:34 -05:00
Darragh Bailey 8805a34c0f Reorder imports to match hacking guidelines
Ensure that the imports follow the standard OpenStack hacking
guidelines.

Change-Id: Iaa4326aef118ddfd807dd006934f1d9ca80a1cfa
2015-12-23 15:23:42 -08:00
Dong Ma 85395266a7 Added "Downstream build of" build selector
jjb copyartifact missing "Downstream build of" build selector
the build selector introduced in CopyArtifact plugin v1.32

Change-Id: Ia0ae5036610c44b88ad75efd9e0a314d0a26eff7
story: 2000437
2015-12-14 12:49:44 +08:00
Ari LiVigni 101f74645d Made a common helper function - convert_mapping_to_xml
This will allow other modules to convert a mapping set to xml easily
with defaults so other methods don't have to create their own.

Includes behaviour to selectively omit or include empty tags.

Behaviour for default value:
  None - omit this tag if users didn't put anything
  "" - create an empty element if users didn't put anything

This is applied to the existing openshift plugin functions in
refactoring as Jenkins actually retains an empty XML tag when the
optional 'auth-token' setting is missing from the input job definition.
Which results in modifying the default test's output for the openshift
plugin.

Change-Id: I935a70ad191bc0f3f3dbd571b2b1cf7468106697
2015-10-09 17:47:01 +01:00
Jenkins c32528fd36 Merge "Add support for Artifactory plugin" 2015-09-30 21:46:40 +00:00
Darragh Bailey a7c0635271 Support copyartifact build selector param
Allow defining of a build selector build parameter to be used by the
copyartifact plugin.

Change-Id: Iac3a3812354c514936ba89ca04dbd7f9ad193073
2015-09-17 23:14:17 +01:00
Ryan Carey a39c4d85d1 Add support for Artifactory plugin
Artifactory support adds three modules to jenkins-job-builder:
1. Artifactory publisher
2. Artifactory wrapper (for Maven projects)
3. Generic-Artifactory wrapper (for other project types)
Change-Id: I801bba707198226d63c94d869cae9167eb4906d4
2015-09-17 13:47:05 -04:00
Will Soula 7de0dc598e Add Ability to use the AWS Cloudformation Plugin
* This plugin gives Jenkins the ability to spawn amazon
cloudformation stacks before running the build and stopping it at
the end

* This change adds cloudformation ability to the builders and the
publishers to create stacks and to the publishers to tear the stack
down

Change-Id: I8041382fc6f1d569c322088a3bc8812332a131e8
2015-08-31 07:45:52 -05:00