Skip to content
Snippets Groups Projects
Commit 23076d54 authored by Anders Harrisson's avatar Anders Harrisson
Browse files

Revert "Use a submodule based repository for OPIs"

This reverts commit 3590dd6c.
parent 84f08c0d
No related branches found
No related tags found
No related merge requests found
Pipeline #116135 passed
......@@ -18,21 +18,15 @@ phoebus_options: "-logging {{ phoebus_home }}/logging.properties"
phoebus_ess_templates_version: 1.0.4
phoebus_ess_symbols_version: 1.0.5
phoebus_ess_opis_version: master
phoebus_opis_repo: https://gitlab.esss.lu.se/opis/directory.git
phoebus_opis_repo_version: main
phoebus_opis_repos: []
phoebus_git_folders_base: /usr/local/share/cs-studio
phoebus_opis_path: "{{ phoebus_git_folders_base }}/opis"
phoebus_ess_symbols_path: "{{ phoebus_git_folders_base }}/ess-symbols"
phoebus_ess_templates_path: "{{ phoebus_git_folders_base }}/ess-templates"
phoebus_layouts_path: "{{ phoebus_git_folders_base }}/layouts"
phoebus_layouts_repo: "https://gitlab.esss.lu.se/accop/shared-cs-studio-phoebus-layouts.git"
phoebus_layouts_version: master
# Set to [] to not create a python environment
phoebus_python_packages:
- epics-base=7.0.3.1=h68659b9_4
- python=3.7
- py4j
- pvapy
- connect2j
- numpy=1.17
- scipy=1.3
......@@ -41,6 +35,37 @@ phoebus_python_packages:
The `-server 4918` option can be added by overriding the `phoebus_options` variable.
The `phoebus_opis_repos` variable is a list of dictionaries with the following keys:
- url: URL to the git repository (mandatory)
- version: version of the repo [default: HEAD]
- dest: directory name where to clone the repo [default: name of the git repo]
Note that `dest` is the relative path under `phoebus_opis_path`.
The following variables:
```yaml
phoebus_opis_path: /data/opis-pbi
phoebus_opis_repos:
- url: https://gitlab.esss.lu.se/beam-diagnostics/opis-pbi/opis-pbi-engineer.git
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"
```
Would create:
```bash
/data/
`-- opis-pbi
|-- 10-Engineer
| `-- 10-ACC
| `-- 99-PBI
`-- 30-Operator
`-- 10-ACC
`-- 99-PBI
```
## Example Playbook
```yaml
......
......@@ -11,8 +11,7 @@ phoebus_options: "-logging {{ phoebus_home }}/logging.properties"
phoebus_ess_templates_version: 1.0.4
phoebus_ess_symbols_version: 1.0.5
phoebus_ess_opis_version: master
phoebus_opis_repo: https://gitlab.esss.lu.se/opis/directory.git
phoebus_opis_repo_version: main
phoebus_opis_repos: []
phoebus_git_folders_base: /usr/local/share/cs-studio
phoebus_opis_path: "{{ phoebus_git_folders_base }}/opis"
phoebus_ess_symbols_path: "{{ phoebus_git_folders_base }}/ess-symbols"
......
......@@ -15,6 +15,15 @@ provisioner:
group_vars:
molecule_group:
phoebus_opis_path: /data/opis-pbi
phoebus_opis_repos:
- url: https://gitlab.esss.lu.se/beam-diagnostics/opis-pbi/opis-pbi-systemexpert.git
version: "1d34327ea88a12fec5e64c38839e038361e0a660"
- url: https://gitlab.esss.lu.se/beam-diagnostics/opis-pbi/opis-pbi-engineer.git
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
......@@ -33,6 +33,18 @@ def test_settings(host):
def test_opis_repositories(host):
for filename in (
"/usr/local/share/cs-studio/ess-opis/README.md",
"/data/opis-pbi/.git/HEAD"
"/data/opis-pbi/opis-pbi-systemexpert/README.md",
"/data/opis-pbi/10-Engineer/10-ACC/99-PBI/README.md",
"/data/opis-pbi/30-Operator/10-ACC/99-PBI/README.md",
):
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
......@@ -148,53 +148,17 @@
- phoebus-ess-opis
- phoebus-git-folders
- name: Check CS-Studio OPI repository location
stat:
path: "{{ phoebus_opis_path }}/.git"
register: phoebus_opis_path_git
tags:
- phoebus-ess-opis
- phoebus-git-folders
- name: Remove old CS-Studio repository location
file:
path: "{{ phoebus_opis_path }}"
state: absent
when: not phoebus_opis_path_git.stat.exists
tags:
- phoebus-ess-opis
- phoebus-git-folders
- name: install CS-Studio OPI repository
- name: install CS-Studio OPIs repositories
git:
repo: "{{ phoebus_opis_repo }}"
dest: "{{ phoebus_opis_path }}"
version: main
recursive: true
repo: "{{ item.url }}"
dest: "{{ phoebus_opis_path }}/{{ item.dest | default(item.url | basename | replace('.git', '')) }}"
version: "{{ item.version | default(omit) }}"
force: true
loop: "{{ phoebus_opis_repos }}"
tags:
- phoebus-ess-opis
- phoebus-git-folders
- name: Check if OPI repository has untracked files
command:
cmd: git status -u --porcelain # noqa 303
chdir: "{{ phoebus_opis_path }}"
register: phoebus_opis_untracked_files
failed_when: false
changed_when: false
tags:
- phoebus-ess-opis
- phoebus-git-folders
- name: Clean any untracked files in OPI repository
command:
cmd: git clean -ffd # noqa 303
chdir: "{{ phoebus_opis_path }}"
when: phoebus_opis_untracked_files.stdout
tags:
- phoebus-ess-opis
- phoebus-git-folders
register: phoebus_git_data
- name: install CS-Studio layouts folder
git:
......@@ -204,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