From 1632a1fd0d18d3a4e2f7468abce2aac2b8013cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 14 Jun 2021 16:45:45 +0200 Subject: [PATCH 1/7] include test.yml --- .../roles/compatibility_layer/tasks/test.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 ansible/playbooks/roles/compatibility_layer/tasks/test.yml diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/test.yml b/ansible/playbooks/roles/compatibility_layer/tasks/test.yml new file mode 100644 index 00000000..144945b7 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/tasks/test.yml @@ -0,0 +1,22 @@ +# Run a ReFrame test suite to validate the correctness +# of the compatibility layer installation. +--- + +- name: Copy ReFrame test file + copy: + src: "{{ playbook_dir }}/../../test/compat_layer.py" + dest: /tmp/compat_layer.py + mode: 0644 + tags: + - test + +- name: Run ReFrame tests + command: reframe -r -v -c /tmp/compat_layer.py + environment: + EESSI_VERSION: "{{ eessi_version }}" + EESSI_OS: "{{ eessi_host_os }}" + EESSI_ARCH: "{{ eessi_host_arch }}" + register: reframe_cmd + failed_when: reframe_cmd.rc != 0 + tags: + - test From ca9f8f2d427680ef8969d8499ec47309e7496645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 14 Jun 2021 16:46:05 +0200 Subject: [PATCH 2/7] include test.yml --- ansible/playbooks/roles/compatibility_layer/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml index 402c9d11..b0c5d8d5 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml @@ -31,6 +31,10 @@ - include_tasks: create_host_symlinks.yml + - include_tasks: test.yml + tags: + - test + - name: Publish transaction command: "cvmfs_server publish {{ cvmfs_repository }}" when: cvmfs_start_transaction and cvmfs_publish_transaction From 2d4a17e8426731405c586ca3dedfe63fcd77e15e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 14 Jun 2021 16:51:16 +0200 Subject: [PATCH 3/7] add changed_when to command --- ansible/playbooks/roles/compatibility_layer/tasks/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/test.yml b/ansible/playbooks/roles/compatibility_layer/tasks/test.yml index 144945b7..a60a7937 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/test.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/test.yml @@ -17,6 +17,7 @@ EESSI_OS: "{{ eessi_host_os }}" EESSI_ARCH: "{{ eessi_host_arch }}" register: reframe_cmd + changed_when: false failed_when: reframe_cmd.rc != 0 tags: - test From d45a6781fe5046e855e987cb0cd6adac6dec904a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Sat, 19 Jun 2021 20:47:27 +0200 Subject: [PATCH 4/7] remove commands at end, will be run by reframe --- .github/actions/install_compatibility_layer/entrypoint.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/install_compatibility_layer/entrypoint.sh b/.github/actions/install_compatibility_layer/entrypoint.sh index aca33c96..6b650469 100755 --- a/.github/actions/install_compatibility_layer/entrypoint.sh +++ b/.github/actions/install_compatibility_layer/entrypoint.sh @@ -6,7 +6,3 @@ cat << EOF > hosts EOF ansible-playbook --connection=local --inventory=hosts -e ansible_python_interpreter=python3 -e gentoo_prefix_path=$1 ${GITHUB_WORKSPACE}/ansible/playbooks/install.yml - -# A successful installation should at least have Lmod and archspec, -# so let's check if we can use them. -source $1/usr/share/Lmod/init/profile && module avail && $1/usr/bin/archspec cpu From 13aa3ae0a5aa1bd9201a5853c9afa0882bdef87a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Sun, 20 Jun 2021 09:47:05 +0200 Subject: [PATCH 5/7] Add fail to rescue block --- ansible/playbooks/roles/compatibility_layer/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml index b0c5d8d5..542bffdc 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml @@ -43,3 +43,7 @@ - name: Abort transaction command: "cvmfs_server abort {{ cvmfs_repository }}" when: cvmfs_start_transaction and cvmfs_abort_transaction_on_failures + + - name: Exit because of failure + fail: + msg: Task {{ ansible_failed_task }} failed, with result {{ansible_failed_result}}. From 56d14ba891ce606a5411d8236439f1733064252a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Sun, 20 Jun 2021 09:50:35 +0200 Subject: [PATCH 6/7] fix linting issues --- ansible/playbooks/roles/compatibility_layer/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml index 542bffdc..c327ad71 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml @@ -46,4 +46,4 @@ - name: Exit because of failure fail: - msg: Task {{ ansible_failed_task }} failed, with result {{ansible_failed_result}}. + msg: "Task {{ ansible_failed_task }} failed, with result {{ ansible_failed_result }}." From 4d7bd925770083a60092f5377898a15b7646ef15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 20:43:40 +0200 Subject: [PATCH 7/7] fix issue with latest symlink, resolve it later --- test/compat_layer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/compat_layer.py b/test/compat_layer.py index 132f2009..965e1c2f 100644 --- a/test/compat_layer.py +++ b/test/compat_layer.py @@ -11,7 +11,7 @@ class RunInGentooPrefixTestError(rfm.core.exceptions.ReframeError): class RunInGentooPrefixTest(rfm.RunOnlyRegressionTest): eessi_repo_dir = '/cvmfs/pilot.eessi-hpc.org' eessi_version = parameter( - os.environ.get('EESSI_VERSION', os.readlink(os.path.join(eessi_repo_dir, 'latest'))).split(',') + os.environ.get('EESSI_VERSION', 'latest').split(',') ) eessi_arch = parameter( os.environ.get('EESSI_ARCH', platform.machine()).split(',') @@ -23,6 +23,9 @@ class RunInGentooPrefixTest(rfm.RunOnlyRegressionTest): def __init__(self): self.valid_systems = ['*'] self.valid_prog_environs = ['*'] + if self.eessi_version == 'latest': + # resolve the "latest" symlink to the actual version + self.eessi_version = os.readlink(os.path.join(eessi_repo_dir, 'latest')) self.compat_dir = os.path.join( self.eessi_repo_dir, self.eessi_version,