Skip to content

Commit

Permalink
Merge pull request EESSI#29 from bedroge/ansible_ci
Browse files Browse the repository at this point in the history
CI for testing compatibility layer installation playbook
  • Loading branch information
peterstol authored Sep 23, 2020
2 parents 560675c + 3341140 commit 8c43c9b
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .github/actions/install_compatibility_layer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM awesomebytes/gentoo_prefix_boostrapped

USER root
RUN apt-get install -y python3-pip
RUN pip3 install ansible

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
13 changes: 13 additions & 0 deletions .github/actions/install_compatibility_layer/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# action.yml
name: 'Install EESSI compatibility layer'
description: 'Use Ansible playbook to install the EESSI compatibility layer inside a Gentoo Prefix Docker container'
inputs:
gentoo-prefix-path:
description: 'Path to the Gentoo Prefix installation'
required: true
default: '/tmp/gentoo'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.gentoo-prefix-path }}
14 changes: 14 additions & 0 deletions .github/actions/install_compatibility_layer/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -l

cat << EOF > hosts
[cvmfsstratum0servers]
127.0.0.1
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/lmod/lmod/init/profile
module avail
$1/usr/bin/archspec cpu
27 changes: 27 additions & 0 deletions .github/workflows/install_compatibility_layer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Install compatibility layer

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
paths:
- 'ansible/playbooks/**'
pull_request:
branches: [ master ]
paths:
- 'ansible/playbooks/**'

jobs:
install_compat_layer:
# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Run install.yml playbook in Docker container
uses: ./.github/actions/install_compatibility_layer
with:
gentoo-prefix-path: '/tmp/gentoo'
3 changes: 3 additions & 0 deletions ansible/playbooks/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 5 additions & 4 deletions ansible/playbooks/roles/compatibility-layer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 8c43c9b

Please sign in to comment.