Skip to content
Snippets Groups Projects
Commit 9107c0ca authored by Te-Hung Tseng's avatar Te-Hung Tseng
Browse files

Del opis not defined in the phoebus_opi_repos variable INFRA-3074

parent f29cb475
No related branches found
No related tags found
1 merge request!6Del opis not defined in the phoebus_opi_repos variable INFRA-3074
......@@ -22,6 +22,8 @@ provisioner:
dest: "10-Engineer/10-ACC/99-PBI"
- url: https://gitlab.esss.lu.se/beam-diagnostics/opis-pbi/opis-pbi-operator.git
dest: "30-Operator/10-ACC/99-PBI"
- url: https://gitlab.esss.lu.se/opis/acc/wtrc/operator.git
dest: 30-Operator/10-ACC/999-WtrC
phoebus_settings:
org.phoebus.pv.ca/addr_list: 127.0.0.1
scenario:
......
......@@ -2,4 +2,23 @@
- name: Prepare
hosts: all
gather_facts: false
tasks: []
tasks:
- name: install required dependencies
yum:
name:
- tar
- gzip
- git
state: present
- name: install undefined opi repositories # noqa 401
git:
repo: "{{ item.url }}"
dest: "{{ phoebus_opis_path }}/{{ item.dest | default(item.url | basename | replace('.git', '')) }}"
force: true
loop:
- url: https://gitlab.esss.lu.se/opis/acc/ts2/rf/engineer.git
dest: 10-Engineer/10-ACC/999-TS2/99-RF
- url: https://gitlab.esss.lu.se/opis/acc/ts2/rf/systemexpert.git
dest: 20-SystemExpert/10-ACC/999-TS2/99-RF
......@@ -40,3 +40,11 @@ def test_opis_repositories(host):
assert host.file(filename).exists
cmd = host.run("cd /data/opis-pbi/opis-pbi-systemexpert;git rev-parse HEAD")
assert cmd.stdout.strip() == "1d34327ea88a12fec5e64c38839e038361e0a660"
def test_opis_repositories_are_deleted(host):
for filename in (
"/data/opis-pbi/20-SystemExpert/10-ACC/999-TS2/99-RF/README.md",
"/data/opis-pbi/10-Engineer/10-ACC/999-TS2/99-RF/README.md",
):
assert host.file(filename).exists is False
......@@ -158,6 +158,7 @@
tags:
- phoebus-ess-opis
- phoebus-git-folders
register: phoebus_git_data
- name: install CS-Studio layouts folder
git:
......@@ -167,3 +168,21 @@
tags:
- phoebus-layouts
- phoebus-git-folders
- name: Find opi repo folders # Searches the opi path for repos with included gitlab-ci.yml file
find:
paths: "{{ phoebus_opis_path }}"
file_type: directory
hidden: true
recurse: true
patterns:
- '.git'
register: phoebus_opis_found_repos
- name: Remove repositories not defined in phoebus_opis_repos # parses through found repos and compare them to defined opi repos.
file:
path: "{{ item.path | dirname }}"
state: absent
when: item.path | dirname not in phoebus_git_data.results | map(attribute='invocation.module_args.dest') | list
loop: "{{ phoebus_opis_found_repos.files }}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment