Skip to content

Commit 417466f

Browse files
committed
config/scripts: align base templates with kubernetes
Align the base templates in config/scripts with the ones in config/kubernetes so that test plans templates such as check-describe (in kernelci-pipeline) can include either base-python.jinja2 or base-k8s-python.jinja2 depending on the runtime environment. Signed-off-by: Guillaume Tucker <[email protected]>
1 parent d58d7c0 commit 417466f

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

config/kubernetes/base-k8s.jinja2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{# -*- mode: YAML -*- -#}
2+
{# SPDX-License-Identifier: LGPL-2.1-or-later -#}
3+
14
apiVersion: batch/v1
25
kind: Job
36
metadata:

config/scripts/base-python.jinja2

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
{%- extends 'base.jinja2' %}
55

6-
{% block script_init -%}
6+
{% block commands %}
7+
{%- block python_imports -%}
78
import os
89
import sys
910
import tarfile
@@ -12,15 +13,19 @@ import yaml
1213

1314
import kernelci.db
1415
import kernelci.config
16+
{% endblock %}
1517

18+
{%- block python_globals %}
1619
DB_CONFIG_YAML = """
1720
{{ db_config_yaml }}"""
18-
NODE_ID = "{{ node_id }}"
19-
TARBALL_URL = "{{ tarball_url }}"
20-
WORKSPACE = "{{ workspace }}"
21+
NODE_ID = '{{ node_id }}'
22+
TARBALL_URL = '{{ tarball_url }}'
23+
WORKSPACE = '/tmp/kci'
2124
{% endblock %}
2225

23-
{% block script_exit -%}
26+
{%- block python_body %}{% endblock %}
27+
28+
{% block python_main -%}
2429
def _get_db():
2530
if not DB_CONFIG_YAML:
2631
return None
@@ -65,3 +70,4 @@ if __name__ == '__main__':
6570

6671
sys.exit(0)
6772
{% endblock %}
73+
{%- endblock %}

config/scripts/base.jinja2

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,5 @@
33

44
#!{{ shebang|default("/bin/sh") }}
55

6-
{% block script_init -%}
7-
set -e
8-
{% endblock -%}
9-
10-
{%- block commands %}{% endblock %}
11-
12-
{% block script_exit -%}
13-
exit 0
14-
{%- endblock %}
6+
{%- block commands %}
7+
{% endblock %}

0 commit comments

Comments
 (0)