diff --git a/atc_renderer/renderer.py b/atc_renderer/renderer.py index 72ec8d5ade0475b41a0cf8edc465917ae82117ae..bf77be173d75e27bae37d6d1925f2b4271091a13 100644 --- a/atc_renderer/renderer.py +++ b/atc_renderer/renderer.py @@ -135,16 +135,17 @@ def get_template_values(testcase_data): install = testcase_data.get('install') if is_automated and install: git_repos = install.get('git-repos', []) - git_repo_url = None + git_repo_url, git_repo_branch = None, None for gr in git_repos: - git_repo_url = gr.get('url') - if not git_repo_url: - print("Error: missing mandatory field install:git-repos:url for " \ + git_repo_url, git_repo_branch = gr.get('url'), gr.get('branch') + if not git_repo_url or not git_repo_branch: + print("Error: missing mandatory field git-repos:url/branch for " \ "automated tests") exit(1) template_values.update({ 'git_repo_url' : git_repo_url }) template_values.update({ 'git_repo_dir' : get_git_repo_dir(git_repo_url) }) + template_values.update({ 'git_repo_branch' : git_repo_branch }) deps = install.get('deps') if deps: diff --git a/atc_renderer/templates/macros.html b/atc_renderer/templates/macros.html index 688590c1f1d51403dbcb454667389b40d761301c..943f42bde9d3916afa2b208446007ab289eba657 100644 --- a/atc_renderer/templates/macros.html +++ b/atc_renderer/templates/macros.html @@ -1,9 +1,9 @@ -{% macro git_repo(git_repo_url, git_repo_dir) %} +{% macro git_repo(url, dir, branch) %} <li class="mb-sm-2">Clone the tests repository from another computer <i>(Note that the branch being tested may change depending on the release, please make sure to clone the correct branch for the release in question)</i>:</li> - <p><kbd>$ git clone {{ git_repo_url }}</kbd></p> - <li class="mb-sm-2">Copy the test directory {{ git_repo_dir }} to the target device:</li> + <p><kbd>$ git clone --branch {{ branch }} {{ url }}</kbd></p> + <li class="mb-sm-2">Copy the test directory {{ dir }} to the target device:</li> <p><kbd>$ DUT_IP=<device-ip></kbd></p> - <p><kbd>$ scp -r {{ git_repo_dir }} user@$DUT_IP:</kbd></p> + <p><kbd>$ scp -r {{ dir }} user@$DUT_IP:</kbd></p> <li class="mb-sm-2">Log into the target device:</li> <p><kbd>$ ssh user@$DUT_IP</kbd></p> {% endmacro %} diff --git a/atc_renderer/templates/test_case.html b/atc_renderer/templates/test_case.html index ec53cc44b83699ce5326003f8d0e06b720e710b6..c76ba814486e717d9a15625f17470344c49b7fed 100644 --- a/atc_renderer/templates/test_case.html +++ b/atc_renderer/templates/test_case.html @@ -43,7 +43,7 @@ {% if pkgname %}{{ macros.ostree_preconditions(pkgname) }}{% endif %} {% if packages_list %}{{ macros.install_packages(packages_list) }}{% endif %} {% if libname %}{{ macros.modules_preconditions(libname) }}{% endif %} - {% if git_repo_url and not pkgname %}{{ macros.git_repo(git_repo_url, git_repo_dir) }}{% endif %} + {% if git_repo_url and not pkgname %}{{ macros.git_repo(git_repo_url, git_repo_dir, git_repo_branch) }}{% endif %} {% for comment, command, output, _, link in pre_conditions %} {% if comment %}<li class="mb-sm-2">{{ comment|e }}</li>{% endif %} {% if command %}<p><kbd>{{ command|e }}</kbd></p>{% endif %}