From 2bece5d556b4dfb9ad29eccbd03a8debe61d9d9a Mon Sep 17 00:00:00 2001 From: Miroslav Vadkerti Date: Feb 14 2023 22:27:31 +0000 Subject: testing-farm: properly handle sidetag repository This is a follow up for #163. As it turned out, in case of a sidetag repo, the repo.url is the url to the repo file, not directly the repo base url. So this PR parses out the repo url from the repo file. Tested via: ``` ❯ ansible -c local -m debug -e repo_url='https://centos.softwarefactory-project.io/logs/14/14/ad79fadaffb361d47f36a0c7597d449702a832b8/check/mock-build/bb0a33c/sidetag.repo' -a "msg={{ lookup('ansible.builtin.url', repo_url) | regex_search('baseurl=([^,]+)', '\\1') }}" localhost localhost | SUCCESS => { "msg": [ "https://kojihub.stream.centos.org/kojifiles/repos/c9s-build-side-1485-stack-gate/latest/x86_64/" ] } ``` Signed-off-by: Miroslav Vadkerti --- diff --git a/roles/testing-farm-run-test/tasks/main.yml b/roles/testing-farm-run-test/tasks/main.yml index db1fe1b..b49938c 100644 --- a/roles/testing-farm-run-test/tasks/main.yml +++ b/roles/testing-farm-run-test/tasks/main.yml @@ -33,11 +33,16 @@ }, "artifacts": [ {%- for repo in zuul.artifacts -%} - {%- if repo.name == 'repo' or repo.name == 'sidetag.repo' -%} + {%- if repo.name == 'repo' -%} { "type": "repository", "id": "{{ repo.url }}" }{%- if not loop.last -%},{%- endif -%} + {%- elif repo.name == 'sidetag.repo' -%} + { + "type": "repository", + "id": "{{ lookup('ansible.builtin.url', repo.url | regex_search('baseurl=([^,]+)', '\\1') }}" + }{%- if not loop.last -%},{%- endif -%} {%- endif -%} {%- endfor -%} ]