Skip to content

Commit 343f9ad

Browse files
committed
Merge branch 'master' into docker_client_pilot
2 parents b0a16ab + c4e0665 commit 343f9ad

29 files changed

+499
-87
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM centos:centos7
2+
3+
USER root
4+
5+
RUN yum install -y epel-release
6+
RUN yum install -y ansible
7+
RUN yum install -y cronie
8+
9+
COPY ./.github/workflows/test-playbook.sh /test-playbook.sh
10+
11+
VOLUME [ “/sys/fs/cgroup” ]
12+
CMD ["/usr/sbin/init"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM centos:centos8
2+
3+
USER root
4+
5+
RUN yum install -y epel-release
6+
RUN yum install -y ansible
7+
RUN yum install -y cronie
8+
9+
COPY ./.github/workflows/test-playbook.sh /test-playbook.sh
10+
11+
VOLUME [ “/sys/fs/cgroup” ]
12+
CMD ["/usr/sbin/init"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:18.04
2+
3+
USER root
4+
5+
RUN apt-get update
6+
RUN apt-get install -y cron gpg python3-pip systemd
7+
8+
RUN pip3 install ansible
9+
10+
COPY ./.github/workflows/test-playbook.sh /test-playbook.sh
11+
12+
VOLUME [ “/sys/fs/cgroup” ]
13+
CMD ["/lib/systemd/systemd"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM ubuntu:20.04
2+
3+
USER root
4+
5+
RUN apt-get update
6+
RUN apt-get install -y cron gpg python3-pip
7+
RUN env DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -y systemd
8+
9+
RUN pip3 install ansible
10+
11+
COPY ./.github/workflows/test-playbook.sh /test-playbook.sh
12+
13+
VOLUME [ “/sys/fs/cgroup” ]
14+
CMD ["/lib/systemd/systemd"]

.github/workflows/ansible-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
# targets: |
2424
# playbook_1.yml
2525
# playbook_2.yml
26-
targets: "*.yml group_vars/*.yml "
26+
targets: "*.yml inventory/group_vars/*.yml"
2727
# [optional]
2828
# Arguments to override a package and its version to be set explicitly.
2929
# Must follow the example syntax.
30-
override-deps: |
31-
ansible==2.9
32-
ansible-lint==4.2.0
30+
#override-deps: |
31+
# ansible==2.9
32+
# ansible-lint==4.2.0
3333
# [optional]
3434
# Arguments to be passed to the ansible-lint
3535

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build client packages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- build_packages
8+
tags:
9+
- 'v*'
10+
pull_request:
11+
branches:
12+
- master
13+
- build_packages
14+
15+
jobs:
16+
17+
build-packages:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Get the version number for the packages
23+
id: get_version
24+
# If this is a tag, use the tag name (e.g. v1.2.3) without v as version number.
25+
# Otherwise, just use 0.0.
26+
run: |
27+
VERSION=0.0
28+
REF_NAME=${{ github.ref }}
29+
[[ $REF_NAME == refs/tags/v* ]] && VERSION=${REF_NAME/refs\/tags\/v/}
30+
echo ::set-output name=version::${VERSION}
31+
32+
# The next step uses a custom Ansible inventory, and due to that it cannot find
33+
# the group_vars folder inside the inventory folder. This symlink fixes that.
34+
- name: Make symlink to group_vars
35+
run: ln -s inventory/group_vars
36+
37+
- name: Prepare package source
38+
uses: roles-ansible/check-ansible-debian-stretch-action@master
39+
with:
40+
targets: "./prepare-client-packages.yml"
41+
hosts: "localhost"
42+
43+
- name: Build RPM package
44+
id: build-rpm
45+
uses: bpicode/github-action-fpm@master
46+
with:
47+
fpm_args: "etc"
48+
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t rpm -a all -s dir -C ./package --description 'CVMFS config repository package for EESSI.'"
49+
50+
- name: Build Deb package
51+
id: build-deb
52+
uses: bpicode/github-action-fpm@master
53+
with:
54+
fpm_args: "etc"
55+
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t deb -a all -s dir -C ./package --description 'CVMFS config repository package for EESSI.'"
56+
57+
- name: Find filenames of downloaded packages
58+
id: find_filenames
59+
shell: bash
60+
run: |
61+
rpmfile="$(ls -1 *.rpm)"
62+
debfile="$(ls -1 *.deb)"
63+
echo ::set-output name=rpmfile::${rpmfile}
64+
echo ::set-output name=debfile::${debfile}
65+
66+
- name: Upload Deb package as artifact
67+
uses: actions/upload-artifact@v2
68+
with:
69+
name: Deb package
70+
path: ${{ steps.find_filenames.outputs.debfile }}
71+
72+
- name: Upload RPM package as artifact
73+
uses: actions/upload-artifact@v2
74+
with:
75+
name: RPM package
76+
path: ${{ steps.find_filenames.outputs.rpmfile }}
77+
78+
release:
79+
needs: build-packages
80+
if: startsWith(github.ref, 'refs/tags/')
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Download Deb package
84+
uses: actions/download-artifact@v2
85+
with:
86+
name: Deb package
87+
88+
- name: Download RPM package
89+
uses: actions/download-artifact@v2
90+
with:
91+
name: RPM package
92+
93+
- name: Find filenames of downloaded packages
94+
id: find_filenames
95+
shell: bash
96+
run: |
97+
rpmfile="$(ls -1 *.rpm)"
98+
debfile="$(ls -1 *.deb)"
99+
echo ::set-output name=rpmfile::${rpmfile}
100+
echo ::set-output name=debfile::${debfile}
101+
102+
- name: Create Release
103+
id: create_release
104+
uses: actions/create-release@v1
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
with:
108+
tag_name: ${{ github.ref }}
109+
release_name: Filesystem Layer ${{ github.ref }}
110+
draft: false
111+
prerelease: false
112+
113+
- name: Upload RPM as release asset
114+
uses: actions/upload-release-asset@v1
115+
env:
116+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
with:
118+
upload_url: ${{ steps.create_release.outputs.upload_url }}
119+
asset_path: ${{ steps.find_filenames.outputs.rpmfile }}
120+
asset_name: ${{ steps.find_filenames.outputs.rpmfile }}
121+
asset_content_type: application/x-rpm
122+
123+
- name: Upload Deb as release asset
124+
uses: actions/upload-release-asset@v1
125+
env:
126+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
with:
128+
upload_url: ${{ steps.create_release.outputs.upload_url }}
129+
asset_path: ${{ steps.find_filenames.outputs.debfile }}
130+
asset_name: ${{ steps.find_filenames.outputs.debfile }}
131+
asset_content_type: application/x-debian-package

.github/workflows/test-playbook.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash -l
2+
3+
playbook=$1
4+
hostgroup=$(grep hosts $playbook | awk '{print $2}')
5+
6+
# Make an inventory file with just the group for which we are running the playbook.
7+
echo "[$hostgroup]" > inventory/hosts
8+
echo "127.0.0.1" >> inventory/hosts
9+
10+
# Make a site-specific configuration file
11+
touch inventory/local_site_specific_vars.yml
12+
echo 'local_cvmfs_http_proxies_allowed_clients:' >> inventory/local_site_specific_vars.yml
13+
echo ' - 127.0.0.1' >> inventory/local_site_specific_vars.yml
14+
15+
# Don't use the GEO API for the Stratum 1, since we do not have a key here.
16+
export CVMFS_GEO_DB_FILE=NONE
17+
18+
# Only test the cvmfs-config repo on the Stratum 1, as the other ones may be very large.
19+
if [ $playbook == "stratum1.yml" ]
20+
then
21+
echo 'cvmfs_repositories: "[{{ eessi_cvmfs_config_repo.repository }}]"' >> inventory/local_site_specific_vars.yml
22+
fi
23+
24+
# Install the Ansible dependencies.
25+
ansible-galaxy role install -r requirements.yml -p ./roles
26+
27+
# Print our site-specific configuration file, for debugging purposes.
28+
cat inventory/local_site_specific_vars.yml
29+
30+
# Run the playbook!
31+
ansible-playbook --connection=local -e @inventory/local_site_specific_vars.yml -v ${playbook}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test Ansible Playbooks
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- "**.md"
9+
- "**.example"
10+
pull_request:
11+
branches:
12+
- master
13+
paths-ignore:
14+
- "**.md"
15+
- "**.example"
16+
17+
jobs:
18+
test-playbook:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
component: [stratum0, stratum1, localproxy, client]
24+
os: [centos-7, centos-8, ubuntu-18.04, ubuntu-20.04]
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Make temporary directory for /srv
28+
run: mkdir ${GITHUB_WORKSPACE}/srv
29+
- name: Build the Docker image
30+
run: docker build . --file ./.github/workflows/Dockerfile-${{ matrix.os }} --tag "docker.pkg.github.com/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/${{ matrix.os }}"
31+
- name: Run the container
32+
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 }}
33+
- name: Execute the playbook
34+
run: docker exec ${{ matrix.component }}-${{ matrix.os }} /test-playbook.sh ${{ matrix.component }}.yml
35+
- name: Execute additional playbook for Stratum 0
36+
run: docker exec ${{ matrix.component }}-${{ matrix.os }} /test-playbook.sh ${{ matrix.component }}-deploy-cvmfs-config.yml
37+
if: ${{ matrix.component == 'stratum0' }}
38+
- name: Stop the container
39+
run: docker kill ${{ matrix.component }}-${{ matrix.os }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
build
12
hosts
23
roles/

0 commit comments

Comments
 (0)