Allow custom settings configs for maven projects

Allow custom settings & global-settings config files to be configured
for maven projects.

In addition, the previously defined empty nodes for these configurations
were misnamed and this corrects that as well.

This change also switches to using an included test as an example.

Change-Id: I9f832f498e358268b3896ead3a78462e408bdd9d
Signed-off-by: Andrew Grimberg <grimbeaj@gmail.com>
Zuul parameter ZUUL_URL

Zuul 2.0 passes to jobs an additional parameter ZUUL_URL which instructs
workers from where to clone repositories.

This is NOT the same as the zuul-url defined by Jenkins Job Builder
which is the notification endpoint set on the jobs and is unrelated.

Change-Id: I4924a5b7ae99571efd70eeb188ddd3d821a4c61b
Catch EPIPE exception and return

Otherwise you get a traceback if you pipe `jenkins-jobs` to the UNIX
`head` command.

Change-Id: If83fd5b9f4aacd031e9ab0c35d61cc6d57542be9
Add more tests

Change-Id: Ie0e0e3906edaa278805917e6303b1d5f1daba864
Add additional yaml/xml tests, literalinclude them

instead of using inline examples in docstrings. With literalinclude, we
know the examples are tested.

Change-Id: I95fbb4726bd6731d9687d09a3d6e7d4e5a445131
Fix "delete-all"

It was broken by 14ed8b12, resulting in:

    $ jenkins-jobs delete-all
    Traceback (most recent call last):
      File "/Users/marca/python/virtualenvs/jenkins-job-builder/bin/jenkins-jobs", line 10, in <module>
        sys.exit(main())
      File "/Users/marca/dev/git-repos/jenkins-job-builder/jenkins_jobs/cmd.py", line 143, in main
        if options.path == sys.stdin:
    AttributeError: 'Namespace' object has no attribute 'path'

Change-Id: I42a3ef9f3cfca7b4667498009351e0027aa316d7
Doc: Use VersionInfo from pbr and remove openstack common modules

The setup was migrated to pbr in d2ff8c0, but the documentation
build is still using VersionInfo from a bundled version of the
openstack common modules.

Migrate the documentation build to use VersionInfo from pbr, and
remove the no-longer-used common modules.

Change-Id: I7dcd5b0328613c7c72efa2df8c26d9c9b1d47c0f
Tiny spelling fix: YMAL -> YAML

Change-Id: Ic37d764cc7b23759202d47d338af22c0ea25f080
Merge "Add more tests"
Merge "Add additional yaml/xml tests, literalinclude them"
support execute-on for postbuildscript

Change-Id: Iccf1fc6bc98f0e78cafc6184b64844be6eba19b8
Fix recursion depth error caused by Git-remotes

In "SCM module: Add support for multiple Git remotes."
(change Ifef2da85, commit 8a956bcc) there is
recursive dict creation introduced when git repo
does not have any remote configured explicitely in yaml.

But infinite recursion confuses builder.deep_format,
so when defaults section contains scm git entry without
remotes specified, and is used by both:
- single job section (which creates the recursive dict),
- job template (which makes deep_format called on that dict)
it fails on RuntimeException.

Tried to build xmls localy with for example
'test -o /tmp/jobs' action.

Traceback looks like:
 File "/jenkins_jobs/cmd.py", line 168, in main
   output=options.output_dir)
 File "/jenkins_jobs/builder.py", line 583, in update_job
   self.parser.generateXML(names)
 File "/jenkins_jobs/builder.py", line 241, in generateXML
   self.getXMLForTemplateJob(d, template, jobs_filter)
 File "/jenkins_jobs/builder.py", line 260, in getXMLForTemplateJob
   expanded = deep_format(template, params)
 File "/jenkins_jobs/builder.py", line 99, in deep_format
   ret[item.format(**paramdict)] = deep_format(obj[item], paramdict)
 File "/jenkins_jobs/builder.py", line 95, in deep_format
   ret.append(deep_format(item, paramdict))
 File "/jenkins_jobs/builder.py", line 99, in deep_format
   ret[item.format(**paramdict)] = deep_format(obj[item], paramdict)
 File "/jenkins_jobs/builder.py", line 99, in deep_format
   ret[item.format(**paramdict)] = deep_format(obj[item], paramdict)
 File "/jenkins_jobs/builder.py", line 95, in deep_format
   ret.append(deep_format(item, paramdict))
 File "/jenkins_jobs/builder.py", line 80, in deep_format
   if isinstance(obj, str):
 RuntimeError: maximum recursion depth exceeded while calling a Python object

Obj passed to deep_format may look like:
    {'origin': {'basedir': 'our-repo',
                'branches': ['origin/master'],
                'remotes': [<Recursion on dict with id=26090448>],
                'url': 'https://our-gerrit.com/our-repo'}}

This patch changes the code to use copy of the git repo dict,
as data for in-place creation of remotes/origin entry,
and as it does not contain 'remotes' key yet, it does not create loop.

Change-Id: Iacd15839c5741cb171253fe45bdd122d7927aa39
Merge "support execute-on for postbuildscript"
Pass argv to main

This will make it easier to do high-level testing because we'll be able
to call main from tests and pass it arguments

Change-Id: I2bac44a746cd61fda963df622b0a775bf4bf31c2
Merge "Catch EPIPE exception and return"
Merge "Doc: Use VersionInfo from pbr and remove openstack common modules"
Checkstyle publisher did not honor 0 values

The Checkstyle publisher would not honor value of 0 and instead emit
an empty XML element.  This was due to the 'if someval' which would be
false whenever someval is 0.  Adjusted tests to match the new (and
correct) behavior.

While at it slightly simplified the repeating logic in checkstyle
publisher.

Change-Id: I7443b93aa116dc049de565ff96ca40526b390409
Merge "Fix "delete-all""
Merge "Allow custom settings configs for maven projects"
Modularize to enable easier testing

Change-Id: I85c5d95658c0be57c4ce87fac53556475ae53207