Raise exceptions when no entrypoint, macro or template found

When generating XML and no component is found for the given yaml entry
whether it is a JJB module, macro or job template, raise an exception
instead of silently continuing by not generating XML and requiring the
user to check the results.

Change-Id: Icd4b1fae123c8bbb4d8af7aa14522251cd9cf8d5
Deprecate projectName setting of CopyArtifact

Starting with version 1.26 of the CopyArtifact plugin all Jenkins job
configurations using this plugin get rewritten on the fly if you run at
least one build. This causes serious failures of the CopyArtifact
feature as soon as the project name includes axis selections.

If the config.xml of a job includes identical project *and* projectName
settings (this is what happens with JJB without this patch), like:

    <project>demojob/axis=$setting</project>
    <projectName>demojob/axis=$setting</projectName>

then it fails to run with current version(s) of the Copy Artifacts
plugin.

The problem is that while the web interface displays the correct
configuration for a fresh job created with JJB (Project Name:
"demojob/axis=$setting" and "Parameter filters" being empty), the
*wrong* configuration is actually used (Project Name: "demojob" and
"Parameter filters: "axis=$setting"). The reason is that when you
execute the job for the first time (after the config.xml was created by
JBB) the Copy Artifacts plugin automatically converts the configuration
to:

    <project>jenkins-debian-glue-binaries</project>
    <parameters>axis=$setting</parameters>

which is something different than wanted and it doesn't work.
This settings stays permanent then until you *manually* fix it.

When you manually select "Configure" on the original job (the one with
project + projectName settings being identical as noted above) in the
web interface without running it first and then click on "Save" it's
fine though, looking like:

    <project>demojob/axis=$setting</project>

Since people usually use current versions of Jenkins plugins (and
version 1.26 of the CopyArtifact plugin was released in March
2013, being ~8 months as of today) and because the python-jenkins
library doesn't offer the ability to query for plugin version
info it's better to just use current defaults instead of breaking
configurations in a quite hard-to-debug way. This also reflects
upstream's opinion about the required change, quoting Jesse Glick
from the Jenkins bug tracker:

| The projectName field is deprecated, and may not be used together
| with project; there is a one-way conversion of projectName (which
| gets deleted) to project plus parameters. If jenkins-job-builder
| writes out a configuration including both fields then it is
| simply buggy.

Change-Id: Ie93316b135dc2b4547922062c7393ea7e5cc4e4c
Provide default ConfigParser object

Replace config dictionary with proper ConfigParser object
to avoid NoSectionError for required options.

Change-Id: Ib1a506641d4bab05e34f80114803bfedf4aa89b7
use jjb tests as the examples

So during my reviews of jjb code I've noticed that many of the examples in
the documentation are either not correct or are out of date.  So instead of
documenting examples in the source I think it would be preferable to
have a test for every module and use that test as the example for the
module.  We run the tests continuously so this will keep the examples
working and up to date.

This patch starts with the scp module.

Change-Id: I161fa22359f8ecb2ae9e511d204c1fa0bce48581
fix jjb configuration documentation

fixed incorrect yaml indentation in the project template and macro section

Change-Id: I9f284dcc39c9c428595c10f4c1bc5e97081392c3
Added support for Stash Notifier

Change-Id: I1e3e95a152de116df62b9124a50e845bc026f608
Ensure jobparams and group_jobparams are dict

When defining a list of jobs in a project, if a colon is added after
the job name but no parameters is provided, jobparams is None.

As dict.update() expects parameter to be iterable, ensure jobparams
and group_jobparams are always a dict to prevent JJB from crashing.

Change-Id: Ie57aa9e5b446fe502dff896cde773ddcc92ba803
Closes-bug: #1253180
Merge "Provide default ConfigParser object"
Merge "fix jjb configuration documentation"
update doc and add new JJB unit tests

Add documentation on how to generate documentation and run JJB unit tests.

Also added a unit tests for each category of plugins as examples for others
to follow when adding new JJB plugins.  I'm hoping this will help contributors
add tests for new plugins going forward.

Change-Id: I2ab90cdb37d0f3b1e947345d4291d2927b04a0c6
Merge "update doc and add new JJB unit tests"
Added support for Jenkins plugin Blame upstream committers

Change-Id: Iefbca697ac93176c9e132e7a0dc04f2b0a7b09f6
Cleaned up fixtures. Removing vim editor settings

Change-Id: I210c1629c513d5e1dfd2b2a16cd7e8361953fc0f
Merge "Ensure jobparams and group_jobparams are dict"
Merge "Added support for Stash Notifier"
Merge "Raise exceptions when no entrypoint, macro or template found"
Merge "Added support for Jenkins plugin Blame upstream committers"
Merge "use jjb tests as the examples"
Merge "Cleaned up fixtures. Removing vim editor settings"
ModuleRegistry now caches entry points lookup

While profiling JJB with cPython with Wikimedia configuration files, the
top three offenders are:

 ncalls  tottime   cumtime  percall filename:lineno(function)
  60697    3.728    10.753    0.000 pkg_resources.py:471(iter_entry_points)
4903683    3.229     3.810    0.000 pkg_resources.py:2396(get_entry_map)
4936493    3.215     3.215    0.000 pkg_resources.py:494(__iter__)

By caching the iter_entry_points call in builder ModuleRegistry, the
execution time drops from 26s to 18s.

Can be further improved by caching the whole group on first lookup and
hold in the cache if entry point in a dict.

Change-Id: Iadc60a805f7690e8388d87f52760a9f6fcd2a53e