23 Commits

Author SHA1 Message Date
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>
2018-01-26 14:14:07 +00:00
Zuul
05e1d8eea1 Merge "Improve test resiliency" 2018-01-20 15:31:49 +00:00
Sorin Sbarnea
c0b3b021dc Improve test resiliency
Avoids occasional test executions failures
caused by leftover files on dev machine or
by preexisting configuration files.

Change-Id: Ia0ba29e2dda58c37410a6926cae3039e4ba3473e
2018-01-18 18:08:56 +00:00
Jonathan Rajotte
8cb7d61dd9 Fix: initialize builder['plugins_info'] to None
Introduced by a7af4a4c100916f77456a8dabbc92a3f935bde62

config.validate() expects the presence of builder['plugins_info'].
Its value can either be null or a list.

Change-Id: Idc9f0be7b25cc254f2aea958d5c3bc8b3ccaac89
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
2018-01-16 00:35:12 -05:00
Darragh Bailey
a7af4a4c10
Tidy up config object
Remove unnecessary class members that are not used or queried after
object initialization.

Remove temporary assignment no longer needed.

Change-Id: Iab2cd2a69fae103967bb20cf2ede4884f4bf67d6
2018-01-12 11:49:17 -05:00
Zuul
1854fde4d9 Merge "No warn on old plugin conf format not in use" 2018-01-12 14:56:05 +00:00
Jonathan Rajotte
30d61a21e8 Fix: use False for default value of query_plugins_info
Based on current documentation:
    If no configuration files are found (either in the default paths or
    given through the command-line), jenkins-jobs will skip querying for
    plugin information

Change-Id: Ic83dfc89eb07013054a5582a8a44e787605db735
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
2018-01-02 16:39:25 +00:00
Darragh Bailey
630fc6e88a No warn on old plugin conf format not in use
Use a simple object to ensure matching against any default value is
possible to distinguish been not being set by a user versus use of
a negative default value passed.

This prevents triggering an incorrect notification to the user when
the code is querying for plugin options that could override the
default behaviour and the compatibility code attempts to look up an non
existing section. It would fail to distinguish between no section
present and current value to return matching the default value
suggested.

Change-Id: I5597c2628ccb5a4282a97a4ce5d3bbe41bd9eebb
2017-12-15 14:18:11 +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
Jenkins
74e020052e Merge "Migrate hipchat conf to new plugin style conf" 2017-08-24 15:19:39 +00:00
Darragh Bailey
906781a752 Migrate hipchat conf to new plugin style conf
Remove the old default hipchat configuration style in favour of
using the new plugin style and provide a mechanism to copy the url
value from the jenkins section automatically as part of a simple
migration.

This will allow removal of querying the jenkins section from existing
module code and allow for better isolation.

Change-Id: I6889777904ebabc01c044abcd31c9d8a20c255c4
2017-08-23 18:31:44 +01:00
Sorin Sbarnea
5d3aa0dbb5 Add support for using multiple servers
Allows user to specify which section from ini config
should be used for loading Jenkins server details.

Change-Id: I57633662e3ca2dba48af8db9e08fb8d5f8bc3bfa
2017-05-30 16:12:51 +01:00
Sorin Sbarnea
8a7d77c180 Removed some deprecation warnings and enabled py35 on tox.
Change-Id: Icc5b28c4636b542a10502b7b1d2d2dc2028cc166
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2017-03-12 19:43:33 +00: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
Wayne Warren
e93f4a5f5a
Convert multiline strings to concatenated single-quote.
Change-Id: Ic0c1be9ca037b67695136583837702d3ec4d42a8
2016-09-14 15:39:36 -04:00
Wayne Warren
c80e3bc5e9
Cleanup various deprecation warnings.
Change-Id: Iec16a5965d62bebb50d3e7307ab93c59304a9ab6
2016-08-20 01:24:49 -04:00
Philip Marc Schwartz
0988c99327 Correct configuration file usage.
This corrects the issue where a config file in a standard location is
not used if --conf <file> is not passed on the command line.

Change-Id: I4a17d342f2751359381658a545441465d4a42a9b
Signed-off-by: Philip Marc Schwartz <philip@progmad.com>
2016-08-05 11:34:58 -07:00
Jenkins
a88104422e Merge "Move JJBConfigException to errors module." 2016-07-22 18:28:25 +00:00
Wayne Warren
df2aa668e0 Move JJBConfigException to errors module.
Change-Id: I20d8874f1c663639a806b6e1b7ff2ef1839313de
2016-07-22 10:14:17 -07:00
Darragh Bailey
652806a751 Ensure flush cache option obeyed
Make sure that flush cache is correct set first by config file, and
additionally that the CLI overrides any defaults.

In the V2 API work, when moving code around the flush cache option was
accidentally removed from being set by the command line or config
files. This ensures it follows the same behaviour as other similar
options.

Change-Id: I9fb1e234e5ed081ada64855389a87d2f7555469e
2016-07-22 17:55:22 +01: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
Darragh Bailey
70334fbf4b Untangle argparser and config objects
Ensure that argparser object only makes use of the JJBConfig object
instead of leaking a command line parser into a config object for API
usage.

Take care to use 'None' as default for store_true/store_false options
in order to ensure that the config file defaults are only overridden
when CLI options are explicitly set.

Change-Id: I4066ad750f9893759c2e9bdfde425fafacc7e672
2016-07-22 15:45:48 +01:00
Wayne Warren
2cf11f014c Use JJBConfig for arg/config initialization.
* Create jenkins_jobs.config module with JJBConfig class.
* Move DEFAULT_CONF from jenkins_jobs.cmd into jenkins_jobs.config
* Move configuration initialization into JJBConfig
* Create method, "do_magical_things" to handle arbitration between
  config file and arguments as well as setting default values for
  config file settings if it doesn't contain the expected keys.
* Move JenkinsJobs.create_parser into its own module,
  jenkins_jobs.cli.parser, it can be used to provide default settings
  in the JJBConfig class when an argparse namespace object is not
  provided; this is primarily necessary because most of the original
  configuration initialization code relies on this being a namespace
  object (simple descendant of the object class).

At this point JJBConfig isn't much more than an object-oriented
version of the way configuration handling happened previously. Its
current form, however, is more amenable to the ultimate goal of the
2.0 refactorings--namely, being able to pass a single config object
around rather than breaking it up into apparently arbitrary settings
necessary to instantiate the Builder class and its delegate objects.

Change-Id: Ic0147e1dccbe620aaaba039a434e7cea6c670054
2016-07-19 18:57:34 +01:00