-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from bedroge/ci
CI for testing all playbooks + fixes for Ubuntu and Centos8
- Loading branch information
Showing
10 changed files
with
154 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
roles: | ||
|
||
- name: galaxyproject.cvmfs | ||
version: 0.2.10 | ||
version: 0.2.13 | ||
|
||
- name: geerlingguy.repo-epel | ||
version: 1.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters