From 40cd345de08fd5962047b74eb0e7fb13720c93f0 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 4 Sep 2020 16:36:55 +0200 Subject: [PATCH 1/5] Clean up, add checks, only run on changes in playbook/ --- .../actions/install_compatibility_layer/Dockerfile | 8 -------- .../actions/install_compatibility_layer/action.yml | 11 ++++------- .../actions/install_compatibility_layer/entrypoint.sh | 6 ++++-- .github/workflows/install_compatibility_layer.yml | 11 +++++------ 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/actions/install_compatibility_layer/Dockerfile b/.github/actions/install_compatibility_layer/Dockerfile index 1a8f292a..be7f66d1 100644 --- a/.github/actions/install_compatibility_layer/Dockerfile +++ b/.github/actions/install_compatibility_layer/Dockerfile @@ -1,17 +1,9 @@ -# Container image that runs your code FROM awesomebytes/gentoo_prefix_boostrapped USER root -#RUN apt-get install -y ansible RUN apt-get install -y python3-pip RUN pip3 install ansible -#USER user - -# Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /entrypoint.sh -#ENV PATH "$HOME/.local/bin:$PATH" - -# Code file to execute when the docker container starts up (`entrypoint.sh`) ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/install_compatibility_layer/action.yml b/.github/actions/install_compatibility_layer/action.yml index f4d23d6d..f111b51d 100644 --- a/.github/actions/install_compatibility_layer/action.yml +++ b/.github/actions/install_compatibility_layer/action.yml @@ -1,16 +1,13 @@ # action.yml -name: 'Install compatibility layer' -description: 'Use Ansible playbook to install the compatibility layer inside a Gentoo Prefix Docker container' +name: 'Install EESSI compatibility layer' +description: 'Use Ansible playbook to install the EESSI compatibility layer inside a Gentoo Prefix Docker container' inputs: - prefix-path: + gentoo-prefix-path: description: 'Path to the Gentoo Prefix installation' required: true default: '/tmp/gentoo' -#outputs: -# time: # id of output -# description: 'The time we greeted you' runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.prefix-path }} + - ${{ inputs.gentoo-prefix-path }} diff --git a/.github/actions/install_compatibility_layer/entrypoint.sh b/.github/actions/install_compatibility_layer/entrypoint.sh index c5a9aa8f..13291939 100755 --- a/.github/actions/install_compatibility_layer/entrypoint.sh +++ b/.github/actions/install_compatibility_layer/entrypoint.sh @@ -5,8 +5,10 @@ cat << EOF > hosts 127.0.0.1 EOF -ansible-playbook --connection=local --inventory=hosts -e ansible_python_interpreter=python3 -e prefix_location=$1 ${GITHUB_WORKSPACE}/playbooks/install.yml +ansible-playbook --connection=local --inventory=hosts -e ansible_python_interpreter=python3 -e gentoo_prefix_path=$1 ${GITHUB_WORKSPACE}/playbooks/install.yml -ls $1/usr/lmod/lmod +# A successfull installation should at least have Lmod and archspec, +# so let's check if we can use them. source $1/usr/lmod/lmod/init/profile module avail +archspec cpu diff --git a/.github/workflows/install_compatibility_layer.yml b/.github/workflows/install_compatibility_layer.yml index d8cae082..d78bdf13 100644 --- a/.github/workflows/install_compatibility_layer.yml +++ b/.github/workflows/install_compatibility_layer.yml @@ -1,5 +1,3 @@ -# This is a basic workflow to help you get started with Actions - name: Install compatibility layer # Controls when the action will run. Triggers the workflow on push or pull request @@ -7,17 +5,18 @@ name: Install compatibility layer on: push: branches: [ master ] + paths: + - 'playbooks/**' pull_request: branches: [ master ] + paths: + - 'playbooks/**' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" install_compat_layer: # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 @@ -25,4 +24,4 @@ jobs: - name: Run install.yml playbook in Docker container uses: ./.github/actions/install_compatibility_layer with: - prefix-path: '/tmp/gentoo' + gentoo-prefix-path: '/tmp/gentoo' From 8d1a9f6ef404ee12b6391a73e4f9c5c395eb21ae Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 4 Sep 2020 16:59:23 +0200 Subject: [PATCH 2/5] Change comment in task to trigger CI --- playbooks/roles/compatibility-layer/tasks/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/playbooks/roles/compatibility-layer/tasks/main.yml b/playbooks/roles/compatibility-layer/tasks/main.yml index d739fe42..66e904d6 100644 --- a/playbooks/roles/compatibility-layer/tasks/main.yml +++ b/playbooks/roles/compatibility-layer/tasks/main.yml @@ -1,7 +1,8 @@ -# TODO: when startprefix does not exist -# use container to install prefix? -#- include_tasks: install_prefix.yml - +# Main task which: +# - checks the given path for a Prefix installation, +# - starts (and publishes at the end) a CVMFS transaction, if requested, +# - calls the tasks for adding the overlay and installation of sets and packages. +--- - name: Check if a Prefix installation is found at the specified location stat: path: "{{ gentoo_prefix_path }}/usr/bin/emerge" From 0df80a00e49c687194aca8e6f90b9e7fb4a16f0e Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 4 Sep 2020 17:23:23 +0200 Subject: [PATCH 3/5] fix path to archspec --- .github/actions/install_compatibility_layer/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/install_compatibility_layer/entrypoint.sh b/.github/actions/install_compatibility_layer/entrypoint.sh index 13291939..28e5c030 100755 --- a/.github/actions/install_compatibility_layer/entrypoint.sh +++ b/.github/actions/install_compatibility_layer/entrypoint.sh @@ -11,4 +11,4 @@ ansible-playbook --connection=local --inventory=hosts -e ansible_python_interpre # so let's check if we can use them. source $1/usr/lmod/lmod/init/profile module avail -archspec cpu +$1/usr/bin/archspec cpu From 64f6211e1a79867aaf47457578988ae519156a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 11 Sep 2020 09:59:04 +0200 Subject: [PATCH 4/5] Add CI status badges --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 19096b6d..d1e30ecb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +![Ansible Lint](https://github.com/EESSI/compatibility-layer/workflows/Ansible%20Lint/badge.svg) +![Install compatibility layer](https://github.com/EESSI/compatibility-layer/workflows/Install%20compatibility%20layer/badge.svg) + # Compatibility layer ## Introduction From 3341140526f209d7dac36ea052a96d816a10e8f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 22 Sep 2020 14:10:25 +0200 Subject: [PATCH 5/5] Move badges from main README to Ansible's README --- README.md | 3 --- ansible/playbooks/README.md | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 46f42c3a..fdc7c857 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ -![Ansible Lint](https://github.com/EESSI/compatibility-layer/workflows/Ansible%20Lint/badge.svg) -![Install compatibility layer](https://github.com/EESSI/compatibility-layer/workflows/Install%20compatibility%20layer/badge.svg) - # Compatibility layer ## Introduction diff --git a/ansible/playbooks/README.md b/ansible/playbooks/README.md index 292c811c..b13bb3a0 100644 --- a/ansible/playbooks/README.md +++ b/ansible/playbooks/README.md @@ -1,3 +1,6 @@ +![Ansible Lint](https://github.com/EESSI/compatibility-layer/workflows/Ansible%20Lint/badge.svg) +![Install compatibility layer](https://github.com/EESSI/compatibility-layer/workflows/Install%20compatibility%20layer/badge.svg) + # Ansible role/playbooks for installing the compatibility layer This directory contains an Ansible role (`compatibility-layer`) in the subdirectory `roles` which has