ci: lava: pass CI_NODE_INDEX and CI_NODE_TOTAL to lava jobs
[mesa.git] / .gitlab-ci / generate_lava.py
1 #!/usr/bin/env python3
2
3 from jinja2 import Environment, FileSystemLoader
4 import argparse
5 import os
6
7 parser = argparse.ArgumentParser()
8 parser.add_argument("--template")
9 parser.add_argument("--base-artifacts-url")
10 parser.add_argument("--device-type")
11 parser.add_argument("--kernel-image-name")
12 parser.add_argument("--kernel-image-type", nargs='?', default="")
13 parser.add_argument("--gpu-version")
14 parser.add_argument("--boot-method")
15 parser.add_argument("--lava-tags", nargs='?', default="")
16 parser.add_argument("--env-vars", nargs='?', default="")
17 parser.add_argument("--deqp-version")
18 parser.add_argument("--arch")
19 parser.add_argument("--ci-node-index")
20 parser.add_argument("--ci-node-total")
21 args = parser.parse_args()
22
23 env = Environment(loader = FileSystemLoader(os.path.dirname(args.template)), trim_blocks=True, lstrip_blocks=True)
24 template = env.get_template(os.path.basename(args.template))
25
26 values = {}
27 values['base_artifacts_url'] = args.base_artifacts_url
28 values['device_type'] = args.device_type
29 values['kernel_image_name'] = args.kernel_image_name
30 values['kernel_image_type'] = args.kernel_image_type
31 values['gpu_version'] = args.gpu_version
32 values['boot_method'] = args.boot_method
33 values['tags'] = args.lava_tags
34 values['env_vars'] = args.env_vars
35 values['deqp_version'] = args.deqp_version
36 values['arch'] = args.arch
37 values['ci_node_index'] = args.ci_node_index
38 values['ci_node_total'] = args.ci_node_total
39
40 f = open('lava-deqp.yml', "w")
41 f.write(template.render(values))
42 f.close()
43