Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI for testing all playbooks + fixes for Ubuntu and Centos8 #40

Merged
merged 84 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
df41678
CI for testing playbooks, only stratum0 first
bedroge Oct 6, 2020
9992d67
test on ci branch for now
bedroge Oct 6, 2020
46e8065
Add custom action for testing playbooks
bedroge Oct 6, 2020
0e04a9c
Use custom action
bedroge Oct 6, 2020
4d2ea97
make entrypoint executable
bedroge Oct 6, 2020
1f7314e
Use centos7 image, install ansible manually
bedroge Oct 6, 2020
186654e
whoops, yum instead of apt
bedroge Oct 6, 2020
0733acd
install python2 bindings for yum
bedroge Oct 6, 2020
a4aae92
install python2 bindings for rpm
bedroge Oct 6, 2020
f288b35
Install ansible with yum
bedroge Oct 6, 2020
c3e7cf7
remove ansible_interpreter
bedroge Oct 6, 2020
d7055af
remove ansible_interpreter -e option
bedroge Oct 6, 2020
57ac982
try to fix systemd
bedroge Oct 6, 2020
a29bb52
Try with centos8
bedroge Oct 6, 2020
d627a08
install httpd manually
bedroge Oct 6, 2020
5b8f265
try without entrypoint.sh
bedroge Oct 6, 2020
4c72d23
fix hosts file
bedroge Oct 6, 2020
65e4137
custom systemctl
bedroge Oct 6, 2020
0c6d238
dont install httpd, add systemctl3.py
bedroge Oct 6, 2020
6973dbd
fake systemd
bedroge Oct 6, 2020
a9c25b1
debug
bedroge Oct 6, 2020
f923e6f
fake systemd in entrypoint
bedroge Oct 6, 2020
ec887a7
remove typo
bedroge Oct 6, 2020
acd7cfa
manually start docker
bedroge Oct 7, 2020
5a4c9cc
manual workflow
bedroge Oct 7, 2020
46c5e9a
move files to workflow
bedroge Oct 7, 2020
7e3cd7e
remove action from workflow
bedroge Oct 7, 2020
83ed226
change location of entrypoint script
bedroge Oct 7, 2020
155e518
fix docker run command
bedroge Oct 7, 2020
4e0efde
fix docker run command
bedroge Oct 7, 2020
12b91ab
push image to github
bedroge Oct 7, 2020
969d460
improve workflow, run init in background
bedroge Oct 7, 2020
a2642a6
remove -it flag
bedroge Oct 7, 2020
93e6f3c
workdir is github_workspace
bedroge Oct 7, 2020
3f27fa5
Add cronie
bedroge Oct 7, 2020
907d3a8
improvements, use strategy in workflow
bedroge Oct 7, 2020
22c6a90
dynamically generate hosts file
bedroge Oct 7, 2020
3703f48
use matrix in steps
bedroge Oct 7, 2020
c375129
use centos 7
bedroge Oct 7, 2020
9c6a09f
Skip GEO DB configuration
bedroge Oct 7, 2020
a00c227
rename dockerfile
bedroge Oct 8, 2020
b53e2d0
ignore .md and .example
bedroge Oct 8, 2020
0366ca8
make os variable, only make snapshots of config repo for stratum1
bedroge Oct 8, 2020
1f18af9
quotes around file paths
bedroge Oct 8, 2020
a4e3cea
quotes around os names
bedroge Oct 8, 2020
a908b1e
remove colon from os names
bedroge Oct 8, 2020
6b5d241
add allowed clients to custom config
bedroge Oct 8, 2020
b021b38
dump config file, add verbose flag
bedroge Oct 8, 2020
f03e597
add tests for localproxy and client playbooks
bedroge Oct 8, 2020
5ddd80c
use DIRECT as default proxy
bedroge Oct 8, 2020
8d71a23
small name change
bedroge Oct 8, 2020
c38e1c6
Add some comments
bedroge Oct 8, 2020
0df3984
Dockerfiles for ubuntu
bedroge Oct 8, 2020
de91988
add more distros
bedroge Oct 8, 2020
bf7a6e3
fix ansible installation procedure
bedroge Oct 8, 2020
f91af53
fix ansible installation procedure
bedroge Oct 8, 2020
3105c68
use /sbin/init on ubuntu
bedroge Oct 8, 2020
7f71b78
don't run init on ubuntu
bedroge Oct 8, 2020
390e808
more specific names for containers, fail-fast to false
bedroge Oct 8, 2020
ba1834c
let detached containers sleep until killed
bedroge Oct 8, 2020
8ed0f27
Fix DIRECT for clients
bedroge Oct 8, 2020
a9f208d
Fix dockerfiles for ubuntu
bedroge Oct 8, 2020
fdc1d06
install ansible with pip3 on ubuntu
bedroge Oct 8, 2020
578f2f3
grr, I said pip3...
bedroge Oct 8, 2020
4c0ee8c
Fix for stratum1: add squid as dep for debian
bedroge Oct 8, 2020
c424fa3
Fix for stratum1: add libapache2-mod-wsgi as dep for debian
bedroge Oct 8, 2020
ca9fa53
extra packages for stratum 0 on debian
bedroge Oct 8, 2020
cd34908
bump version of galaxyproject.cvmfs to 0.2.13
bedroge Oct 8, 2020
092ab9e
use systemd on ubuntu
bedroge Oct 8, 2020
911e705
retrigger CI
bedroge Oct 8, 2020
3d33681
avoid interactive questions from tzdata
bedroge Oct 8, 2020
80b67f8
Fix for Centos 8
bedroge Oct 8, 2020
1a2ac5c
Add centos 8 tests
bedroge Oct 8, 2020
631da22
oops. 7 -> 8
bedroge Oct 8, 2020
363b1ed
Clean up
bedroge Oct 9, 2020
01a0716
remove ci branch from targets
bedroge Oct 9, 2020
1fc36a9
Use {{ github.repository }} instead of GITHUB_REPOSITORY
bedroge Oct 9, 2020
3d0a307
convert repo name to lowercase
bedroge Oct 9, 2020
114edc4
use unmodified name for push and pull
bedroge Oct 9, 2020
d82d06d
all repo names lowercase again
bedroge Oct 9, 2020
38218a9
Remove GPR steps
bedroge Oct 9, 2020
a862adc
Fix copied line
bedroge Oct 9, 2020
8822e7a
remove ci branch from targets
bedroge Oct 9, 2020
f5fe46a
Change name of step
bedroge Oct 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/Dockerfile-centos-7
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM centos:centos7

USER root

RUN yum install -y epel-release
RUN yum install -y ansible
RUN yum install -y cronie

COPY ./.github/workflows/test-playbook.sh /test-playbook.sh

VOLUME [ “/sys/fs/cgroup” ]
CMD ["/usr/sbin/init"]
12 changes: 12 additions & 0 deletions .github/workflows/Dockerfile-centos-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM centos:centos8

USER root

RUN yum install -y epel-release
RUN yum install -y ansible
RUN yum install -y cronie

COPY ./.github/workflows/test-playbook.sh /test-playbook.sh

VOLUME [ “/sys/fs/cgroup” ]
CMD ["/usr/sbin/init"]
13 changes: 13 additions & 0 deletions .github/workflows/Dockerfile-ubuntu-18.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:18.04

USER root

RUN apt-get update
RUN apt-get install -y cron gpg python3-pip systemd

RUN pip3 install ansible

COPY ./.github/workflows/test-playbook.sh /test-playbook.sh

VOLUME [ “/sys/fs/cgroup” ]
CMD ["/lib/systemd/systemd"]
14 changes: 14 additions & 0 deletions .github/workflows/Dockerfile-ubuntu-20.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:20.04

USER root

RUN apt-get update
RUN apt-get install -y cron gpg python3-pip
RUN env DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -y systemd

RUN pip3 install ansible

COPY ./.github/workflows/test-playbook.sh /test-playbook.sh

VOLUME [ “/sys/fs/cgroup” ]
CMD ["/lib/systemd/systemd"]
31 changes: 31 additions & 0 deletions .github/workflows/test-playbook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -l

playbook=$1
hostgroup=$(grep hosts $playbook | awk '{print $2}')

# Make an inventory file with just the group for which we are running the playbook.
echo "[$hostgroup]" > inventory/hosts
echo "127.0.0.1" >> inventory/hosts

# Make a site-specific configuration file
touch inventory/local_site_specific_vars.yml
echo 'local_cvmfs_http_proxies_allowed_clients:' >> inventory/local_site_specific_vars.yml
echo ' - 127.0.0.1' >> inventory/local_site_specific_vars.yml

# Don't use the GEO API for the Stratum 1, since we do not have a key here.
export CVMFS_GEO_DB_FILE=NONE

# Only test the cvmfs-config repo on the Stratum 1, as the other ones may be very large.
if [ $playbook == "stratum1.yml" ]
then
echo 'cvmfs_repositories: "[{{ eessi_cvmfs_config_repo.repository }}]"' >> inventory/local_site_specific_vars.yml
fi

# Install the Ansible dependencies.
ansible-galaxy role install -r requirements.yml -p ./roles

# Print our site-specific configuration file, for debugging purposes.
cat inventory/local_site_specific_vars.yml

# Run the playbook!
ansible-playbook --connection=local -e @inventory/local_site_specific_vars.yml -v ${playbook}
39 changes: 39 additions & 0 deletions .github/workflows/test-playbooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test Ansible Playbooks

on:
push:
branches:
- master
paths-ignore:
- "**.md"
- "**.example"
pull_request:
branches:
- master
paths-ignore:
- "**.md"
- "**.example"

jobs:
test-playbook:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
component: [stratum0, stratum1, localproxy, client]
os: [centos-7, centos-8, ubuntu-18.04, ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Make temporary directory for /srv
run: mkdir ${GITHUB_WORKSPACE}/srv
- name: Build the Docker image
run: docker build . --file ./.github/workflows/Dockerfile-${{ matrix.os }} --tag "docker.pkg.github.com/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/${{ matrix.os }}"
- name: Run the container
run: docker run -d --workdir /github/workspace --rm -e INPUT_PLAYBOOK -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v $HOME:"/github/home" -v "$HOME/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "$GITHUB_WORKSPACE":"/github/workspace" --privileged --device /dev/fuse --mount type=bind,source=${GITHUB_WORKSPACE}/srv,target=/srv --mount type=bind,source=${GITHUB_WORKSPACE}/srv,target=/var/spool/cvmfs --name ${{ matrix.component }}-${{ matrix.os }} docker.pkg.github.com/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/${{ matrix.os }}
- name: Execute the playbook
run: docker exec ${{ matrix.component }}-${{ matrix.os }} /test-playbook.sh ${{ matrix.component }}.yml
- name: Execute additional playbook for Stratum 0
run: docker exec ${{ matrix.component }}-${{ matrix.os }} /test-playbook.sh ${{ matrix.component }}-deploy-cvmfs-config.yml
if: ${{ matrix.component == 'stratum0' }}
- name: Stop the container
run: docker kill ${{ matrix.component }}-${{ matrix.os }}
2 changes: 1 addition & 1 deletion inventory/group_vars/cvmfsclients
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# List of proxies to be used for the clients.
# Override this setting in your local_site_specific_vars.yml file.
cvmfs_http_proxies: "{{ local_cvmfs_http_proxies }}"
cvmfs_http_proxies: "{{ local_cvmfs_http_proxies | default(['DIRECT']) }}"

# Use the CVMFS configuration repository for the clients.
eessi_cvmfs_repos_enabled: config-repo
2 changes: 1 addition & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
roles:

- name: galaxyproject.cvmfs
version: 0.2.10
version: 0.2.13

- name: geerlingguy.repo-epel
version: 1.3.0
10 changes: 10 additions & 0 deletions stratum0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
---
- name: CVMFS Stratum 0
hosts: cvmfsstratum0servers
pre_tasks:
- name: Fix that adds additional dependencies for Debian systems
set_fact:
cvmfs_packages:
stratum0:
- apache2
- cvmfs-server
- cvmfs-config-default
- cvmfs
when: ansible_facts['os_family'] == 'Debian'
roles:
- role: geerlingguy.repo-epel
when: ansible_facts['os_family'] == 'RedHat'
Expand Down
21 changes: 21 additions & 0 deletions stratum1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@
---
- name: CVMFS Stratum 1
hosts: cvmfsstratum1servers
pre_tasks:
- name: Fix that adds additional dependencies for Debian systems
set_fact:
cvmfs_packages:
stratum1:
- apache2
- libapache2-mod-wsgi
- squid
- cvmfs-server
- cvmfs-config-default
when: ansible_facts['os_family'] == 'Debian'
- name: Fix for CentOS 8
set_fact:
cvmfs_packages:
stratum1:
- httpd
- python3-mod_wsgi
- squid
- cvmfs-server
- cvmfs-config-default
when: ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] == '8'
roles:
- role: geerlingguy.repo-epel
when: ansible_facts['os_family'] == 'RedHat'
Expand Down