Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Created June 27, 2017 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughsaunders/4b3deb395dc6aa56eec5f4e1e508ed60 to your computer and use it in GitHub Desktop.
Save hughsaunders/4b3deb395dc6aa56eec5f4e1e508ed60 to your computer and use it in GitHub Desktop.
Bool lower case problem
- defaults:
name: global
TEST_BOOL_DEFAULT: true
TEST_STRING_DEFAULT: "/opt/foo"
- parameter:
name: my_params
parameters:
- bool:
name: TEST_BOOL
default: "{TEST_BOOL_DEFAULT}"
- string:
name: TEST_STRING
default: "{TEST_STRING_DEFAULT}"
- project:
name: test
jobs:
- job1
- job2
- job-template:
name: job1
parameters:
- my_params:
- job-template:
name: job2
parameters:
- my_params:
TEST_BOOL_DEFAULT: false
TEST_STRING_DEFAULT: "/opt/baz"
16:47 $ jenkins-jobs test htests.yml
WARNING:jenkins_jobs.config:Config file, /etc/jenkins_jobs/jenkins_jobs.ini, not found. Using default config values.
INFO:jenkins_jobs.config:Will use anonymous access to Jenkins if needed.
INFO:jenkins_jobs.cli.subcommand.update:Updating jobs in ['htests.yml'] ([])
WARNING:jenkins_jobs.builder:Unable to retrieve Jenkins Plugin Info from http://localhost:8080/, using default empty plugins info list.
ERROR:root:Problem formatting with args:
allow_empty:False
obj: OrderedDict([('name', 'TEST_BOOL'), ('default', '{test_bool_default}')])
paramdict: OrderedDict([('TEST_BOOL_DEFAULT', False), ('TEST_STRING_DEFAULT', '/opt/baz')])
ERROR:root:Failure formatting component ('bool') data 'OrderedDict([('name', 'TEST_BOOL'), ('default', '{test_bool_default}')])'
Traceback (most recent call last):
File "/Users/hughsaunders/Documents/context/UG-619/venv/bin/jenkins-jobs", line 10, in <module>
sys.exit(main())
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/cli/entry.py", line 145, in main
jjb.execute()
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/cli/entry.py", line 139, in execute
ext.obj.execute(self.options, self.jjb_config)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/cli/subcommand/test.py", line 55, in execute
options, jjb_config)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/cli/subcommand/update.py", line 88, in _generate_xmljobs
xml_jobs = xml_job_generator.generateXML(job_data_list)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/xml_config.py", line 77, in generateXML
xml_jobs.append(self._getXMLForJob(job))
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/xml_config.py", line 88, in _getXMLForJob
self._gen_xml(xml, data)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/xml_config.py", line 98, in _gen_xml
module.gen_xml(xml, data)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/modules/parameters.py", line 908, in gen_xml
self.registry.dispatch('parameter', pdefs, param)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/registry.py", line 251, in dispatch
self.dispatch(component_type, xml_parent, b, component_data)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/registry.py", line 169, in dispatch
self.jjb_config.yamlparser['allow_empty_variables'])
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/formatter.py", line 58, in deep_format
deep_format(obj[item], paramdict, allow_empty)
File "/Users/hughsaunders/Documents/context/UG-619/jenkins-job-builder/jenkins_jobs/formatter.py", line 42, in deep_format
raise JenkinsJobsException(desc)
jenkins_jobs.errors.JenkinsJobsException: test_bool_default parameter missing to format {test_bool_default}
Given:
OrderedDict([('TEST_BOOL_DEFAULT', False), ('TEST_STRING_DEFAULT', '/opt/baz')])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment