Commit Graph

4 Commits

Author SHA1 Message Date
Vsevolod Fedorov 6b92807cd7 Tests: Rename yamlparser tests and fixture directories
Rename fixtures directory to job_fixtures to prepare for adding view_fixtures
directory in the following commits.

Change-Id: Ic20997cae020b542ddc22bf444fa6b92fbcae064
2023-01-26 11:06:23 +03:00
Sorin Sbarnea c2781e670f
Normalize newlines at end of file
Preparatory move for adopting pre-commit hooks.
Shoudl only remove newlines and spaces at end of files.

Change-Id: Ia33679467c533722b9308f7e7b74be395c926428
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2018-06-29 16:07:06 -04:00
Darragh Bailey 07c5bd1cc3 Test creation of multiple jobs from templates
Concatenate each job XML created from the parsed yaml when using the
YamlParser class for testing. Ensures that multiple jobs created from a
single yaml file can be tested.

Remove erroneous multiple job from scm_remote_deep_bug test.

Change-Id: I2732a7303fefff1f321a1a5b7eef9144d168e39a
2014-05-10 22:21:06 +01:00
Pavel Sedlák 20acdc5e90 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
2014-05-02 12:39:58 +02:00