6 Commits

Author SHA1 Message Date
Wayne Warren
0da11b51c5 Use JJBConfig in ModuleRegistry.
Remove reference to ConfigParser object in ModuleRegistry. Instead:
* make use of JJBConfig.get_module_config to grab settings for Hipchat
  Notifier Plugin
* make use of JJBConfig.yamlparser['allow_empty_variables'] rather
  than repeating ConfigParser logic moved out of the YamlParser into
  JJBConfig in an earlier commit.

Change-Id: Icb7ef514826005545e48af993335ce120f973b0d
2016-07-22 17:33:30 +01:00
Andreas Jaeger
165a9ebd7f Warn only once for masked definitions
Currently JJB warns over 700 times when checking project-config with:
  WARNING:jenkins_jobs.registry:You have a macro ('tox') defined for
  'builder' component type that is masking an inbuilt definition

Warn only once for this.

Change-Id: I010765269c499320fc9a84b9493d22949080e9a0
2016-01-06 16:57:00 +01:00
Darragh Bailey
0cafeba626 Order component retrieval to favour user defined
Prefer user defined macros over inbuilt entry points, as JJB may
accidentally use a name that has already been used by an end-user to
define a custom macro.

Warn users when they have a macro defined that masks an in-built
component to avoid accidentally changing XML generated with new
releases.

Change-Id: I6cae62d7cc40be6c4a5636a74f151fcce4cdd856
2015-12-12 19:09:01 +00:00
Darragh Bailey
449bb24f8f Infer and build entry points from component modules
Use the component type entry points to infer modules to scan
corresponding modules and automatically construct entry points for any
functions associated with yaml entries in JJB definitions.

This removes the need for new JJB modules added directly to the project
to also need to be listed in the setup.cfg to be reachable. Simply
adding the needed functionality to the correct file ensures that it is
available.

Change-Id: I2a0fd8f6720ddfd8582b58e47556a87ed1ad553d
2015-12-12 19:07:26 +00:00
Justin Stoller
bf88fe32c1 Allow deep formatting of macro parameters
Prior to this patch macros serialized into a yaml document, a simple string
substitution was applied and then they were re-loaded into python. This
created several problems:
 - newlines are lost because the yaml loading was not respecting the
   newline settings of the original strings (Story: 1387060)
 - {obj:} notation was not working for macro parameters (Story: 2000254)
 - multiline strings passed into scripts will create a yaml syntax error
   when being re-loaded (unticketed)

This patch resolves these problems by replacing the previous interpolation
code with the more robust `deep_format` method. A side effect of this patch
is that there are now fewer disparate code paths for interpolating variables.

Change-Id: Ia06c98286537a50dc52c6e5e000b32ebc9e8ede2
Signed-off-by: Justin Stoller <justin.stoller@gmail.com>
2015-11-13 10:57:36 -08:00
Wayne
4a8b93b8c2 Remove YamlParser from jenkins_jobs.builder
The goal of this patch is simply to move some classes out of
jenkins_jobs.builder into more appropriately-named modules. This started with
simply moving YamlParser into jenkins_jobs.parser but led to other moves in
order to avoid cyclic imports since YamlParser uses other classes previously
defined in jenkins_jobs.builder.

That said, this patch doesn't intend to address all of the clutter in
jenkins_jobs.builder, mostly just what is necessary to get started working on
YamlParser independent of other classes in that module.

Change-Id: Ie88bf683e495033eb0b670fe29c256a70282735f
2015-04-22 11:59:07 -07:00