Hi Dan, hi Neil,
Here's an example of generating lava templates using jinja2. It's probably more complicated than you need.
See https://git.linaro.org/ci/job/configs.git/tree/openembedded-lkft/lava -job-definitions for a directory of templates, and see https://git.linaro.org/ci/job/configs.git/tree/openembedded-lkft/subm it_for_testing.py for the python code that does the generation. Lastly, you can run https://git.linaro.org/ci/job/configs.git/tree/openembedded-lkft/test _submit_for_testing.sh and it will generate all of the YAML files into "./tmp".
Like I said, this is likely more complicated than you are looking for. I suggest starting simpler using https://pypi.python.org/pypi/jinja2-cli/0.6.0.
Thank you, that really helps a lot. We want to trigger the LAVA jobs from Jenkins as well, and we need lots of metadata because the tests will be part of our release notes in the end. So no, this is definitely not more complicated than we need. In fact, this is a very good starting point for us.
In that case, I can explain a bit more about the layout. We run about 20 lava jobs for each of about 9 different device types. Instead of maintaining 20*9 lava job yaml files with lots of duplication, we have one template file per device (/devices/), and one template file per test type (/testplan/). For the tests, there's still some duplication between similar tests so we abstracted it out into a couple master test files that take an argument.
This allows us to keep the job templates DRY which is critical for maintenance and consistency concerns over time.
It is a little goofy to write out structured data files using a templating language, but it actually does work quite well, and isn't something we invented here. Ansible, for example, uses yaml+jinja2 extensively. There are also filters in jinja2 such as to_json and to_yaml that can be used to dump larger data structures directly.
Dan
in the meantime I managed to set up a template structure along with a script to construct job definitions suiting our needs. Thanks again for your help.
I have a further question: As far as I see, everyone seems to keep job definitions (or templates for those) and test definitions in separate repositories. Is there a certain reason for this? Why shouldn't I put job templates and test definitions that belong together side by side in the same folder?
Mit freundlichen Grüßen / Best regards Tim Jaacks DEVELOPMENT ENGINEER Garz & Fricke GmbH Tempowerkring 2 21079 Hamburg Direct: +49 40 791 899 - 55 Fax: +49 40 791899 - 39 tim.jaacks@garz-fricke.com www.garz-fricke.com SOLUTIONS THAT COMPLETE!
Sitz der Gesellschaft: D-21079 Hamburg Registergericht: Amtsgericht Hamburg, HRB 60514 Geschäftsführer: Matthias Fricke, Manfred Garz