summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/config.py
Commit message (Collapse)AuthorAgeFilesLines
* Auto-generated output from python-blackThanh Ha2019-09-091-96/+112
| | | | | | | | | 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>
* Avoid ResourceWarning by closing file handlers when finishedPhilip Roche2019-07-291-0/+3
| | | | | | | | | | | | | | Warnings appear when running local_yaml unit tests. This commit fixes the issues causing these warnings ``` ResourceWarning: unclosed file <_io.TextIOWrapper name='jenkins-job-builder/tests/yamlparser/fixtures/include_path001.conf' mode='r' encoding='utf-8'> jjb_config = JJBConfig(self.conf_filename) ``` Change-Id: I8fec288cce8c9f6c7b928886d7c70f7a35d43b4a
* remove support of old plugin config formatSorin Sbarnea2019-04-161-15/+2
| | | | | | Remove code refering to old plugin config format. Change-Id: Iba0922d3bfe066444e5e982c303968d15e1853a1
* Fix new flake8 failuresDaniel Watkins2019-01-301-3/+3
| | | | Change-Id: Ieb7f80f25d7fe640caede8d8aef76950ca498723
* Add config options --jobs-only and --views-onlyAnil Belur2018-09-191-0/+6
| | | | | | | | | | | | | | | | | | | | | Add options --jobs-only and --views-only to job_builder section in config file. By default JJB updates both jobs and views. Some cases non-admin users are not allowed to update views on Jenkins which requires explicity using -j flag. Allow users to set a config option 'update=jobs|views|all' in the 'job_builder' section implicitly use --jobs-only or --views-only and control these flags from the config file. Note: CLI options takes precedence over the config file. Change-Id: I2a94e5a2d671ccbfc505de2f19b578ecfef9e9d7 Co-Authored-By: Thanh Ha <zxiiro@linux.com> Signed-off-by: Anil Belur <askb23@gmail.com> Signed-off-by: Thanh Ha <zxiiro@linux.com> Signed-off-by: Anil Belur <askb23@gmail.com>
* Merge "Add retain_anchors config option."Zuul2018-06-061-0/+8
|\
| * Add retain_anchors config option.Vicky Chijwani2018-05-311-0/+8
| | | | | | | | | | | | | | | | | | If set to True, YAML anchors can be referenced across files, allowing jobs to be composed from bits of YAML defined in separate files. False by default. Story: 2000338 Task: 2547 Change-Id: I034ce3bce0030093cb8d4266dabbdb06d96306d6
* | Make the deprecated plugin config messaging clearerDaniel Watkins2018-05-301-4/+7
|/ | | | | | | | | | At the moment, if you don't know that you have configuration for the given plugin in your config file, there's nothing that actually suggests that's where you should start looking to fix this. Change-Id: I32481eb9b1a4feafc8b8ca2cec63e4b9a0b29441 Story: 2001735 Task: 12090
* Added option to print job names as urlsSorin Sbarnea2018-01-261-0/+7
| | | | | | | | 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>
* Merge "Improve test resiliency"Zuul2018-01-201-4/+4
|\
| * Improve test resiliencySorin Sbarnea2018-01-181-4/+4
| | | | | | | | | | | | | | | | Avoids occasional test executions failures caused by leftover files on dev machine or by preexisting configuration files. Change-Id: Ia0ba29e2dda58c37410a6926cae3039e4ba3473e
* | Fix: initialize builder['plugins_info'] to NoneJonathan Rajotte2018-01-161-1/+3
|/ | | | | | | | | | 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>
* Tidy up config objectDarragh Bailey2018-01-121-39/+23
| | | | | | | | | Remove unnecessary class members that are not used or queried after object initialization. Remove temporary assignment no longer needed. Change-Id: Iab2cd2a69fae103967bb20cf2ede4884f4bf67d6
* Merge "No warn on old plugin conf format not in use"Zuul2018-01-121-5/+9
|\
| * No warn on old plugin conf format not in useDarragh Bailey2017-12-151-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix: use False for default value of query_plugins_infoJonathan Rajotte2018-01-021-1/+1
|/ | | | | | | | | | 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>
* Switch param order from yaml conf to plugin specificDarragh Bailey2017-09-221-10/+13
| | | | | | | | | | | | | | | | | | | 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
* Merge "Migrate hipchat conf to new plugin style conf"Jenkins2017-08-241-5/+32
|\
| * Migrate hipchat conf to new plugin style confDarragh Bailey2017-08-231-5/+32
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add support for using multiple serversSorin Sbarnea2017-05-301-10/+16
|/ | | | | | | Allows user to specify which section from ini config should be used for loading Jenkins server details. Change-Id: I57633662e3ca2dba48af8db9e08fb8d5f8bc3bfa
* Removed some deprecation warnings and enabled py35 on tox.Sorin Sbarnea2017-03-121-6/+6
| | | | | Change-Id: Icc5b28c4636b542a10502b7b1d2d2dc2028cc166 Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
* Add convenience function for plugin namespaceThanh Ha2016-11-111-0/+15
| | | | | | | | | | | | | | | | | 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>
* Convert multiline strings to concatenated single-quote.Wayne Warren2016-09-141-6/+7
| | | | Change-Id: Ic0c1be9ca037b67695136583837702d3ec4d42a8
* Cleanup various deprecation warnings.Wayne Warren2016-08-201-2/+9
| | | | Change-Id: Iec16a5965d62bebb50d3e7307ab93c59304a9ab6
* Correct configuration file usage.Philip Marc Schwartz2016-08-051-4/+9
| | | | | | | | 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>
* Merge "Move JJBConfigException to errors module."Jenkins2016-07-221-4/+1
|\
| * Move JJBConfigException to errors module.Wayne Warren2016-07-221-4/+1
| | | | | | | | Change-Id: I20d8874f1c663639a806b6e1b7ff2ef1839313de
* | Ensure flush cache option obeyedDarragh Bailey2016-07-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Use JJBConfig in YamlParser.Wayne Warren2016-07-221-7/+75
|/ | | | | | | | | | | | | | | 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
* Untangle argparser and config objectsDarragh Bailey2016-07-221-100/+52
| | | | | | | | | | | | 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
* Use JJBConfig for arg/config initialization.Wayne Warren2016-07-191-0/+279
* 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