ci/b2c: add support for the new format of CI_RUNNER_TAGS

Seems like Gitlab did not follow their own documentation:

```
CI_RUNNER_TAGS  8.10  0.5  A comma-separated list of the runner tags.
```

But it would seem like a gitlab update brought json-style lists which
broke:

```
CI_RUNNER_TAGS = '["keywords-gateway", "CI-gateway"]'
```

This commit adds support for both style.

Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Reviewed-by: John Brooks <john@fastquake.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18923>
This commit is contained in:
Martin Roukala (né Peres)
2022-10-01 06:46:19 +03:00
committed by Marge Bot
parent bd9d276485
commit bb91117204
2 changed files with 6 additions and 3 deletions

View File

@@ -3,9 +3,8 @@ version: 1
# Rules to match for a machine to qualify # Rules to match for a machine to qualify
target: target:
{% if tags %} {% if tags %}
{% set b2ctags = tags.split(',') %}
tags: tags:
{% for tag in b2ctags %} {% for tag in tags %}
- '{{ tag | trim }}' - '{{ tag | trim }}'
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -24,6 +24,7 @@
from jinja2 import Environment, FileSystemLoader from jinja2 import Environment, FileSystemLoader
from argparse import ArgumentParser from argparse import ArgumentParser
from os import environ, path from os import environ, path
import json
parser = ArgumentParser() parser = ArgumentParser()
@@ -69,7 +70,10 @@ values['log_level'] = args.log_level
values['poweroff_delay'] = args.poweroff_delay values['poweroff_delay'] = args.poweroff_delay
values['session_end_regex'] = args.session_end_regex values['session_end_regex'] = args.session_end_regex
values['session_reboot_regex'] = args.session_reboot_regex values['session_reboot_regex'] = args.session_reboot_regex
values['tags'] = args.tags try:
values['tags'] = json.loads(args.tags)
except json.decoder.JSONDecodeError:
values['tags'] = args.tags.split(",")
values['template'] = args.template values['template'] = args.template
values['timeout_boot_minutes'] = args.timeout_boot_minutes values['timeout_boot_minutes'] = args.timeout_boot_minutes
values['timeout_boot_retries'] = args.timeout_boot_retries values['timeout_boot_retries'] = args.timeout_boot_retries