Skip to content

Commit ebd6cc5

Browse files
authored
Merge pull request #24 from EESSI/build_packages
Build deb and rpm packages for clients
2 parents d7179ed + 09a24ef commit ebd6cc5

File tree

4 files changed

+215
-0
lines changed

4 files changed

+215
-0
lines changed
+131
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-esssi -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-esssi -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

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
build
12
hosts
23
roles/

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ ansible-playbook -b -K -e @inventory/local_site_specific_vars.yml localproxy.yml
135135
```
136136

137137
### Clients
138+
139+
#### Method 1: Ansible
138140
Make sure that your hosts file contains the list of hosts where the CVMFS client should be installed.
139141
Furthermore, you can define a list of (local) proxy servers
140142
that your clients should use in `inventory/local_site_specific_vars.yml` using the parameter `local_cvmfs_http_proxies`.
@@ -146,6 +148,33 @@ Finally, run the playbook:
146148
ansible-playbook -b -K -e @inventory/local_site_specific_vars.yml client.yml
147149
```
148150

151+
#### Method 2: Packages
152+
On many operating systems the CVMFS client can be installed through your package manager.
153+
For details, see the [Getting Started page](https://cvmfs.readthedocs.io/en/stable/cpt-quickstart.html)
154+
in the documentation.
155+
156+
After installing the client, you will have to configure it.
157+
For this you can use the CVMFS configuration packages that we provide for clients.
158+
These packages can be found on the [Releases](https://github.com/eessi/filesystem-layer/releases) page.
159+
Download the package for your operating system, and install it, e.g.:
160+
```
161+
rpm -i cvmfs-config-eessi-*.rpm
162+
dpkg -i cvmfs-config-eessi-*.deb
163+
```
164+
165+
Next, you need to make a file `/etc/cvmfs/default.local` manually; this file is used for local settings and
166+
contains, for instance, the URL to your local proxy and the size of the local cache. As an example, you can put
167+
the following in this file, which corresponds to not using a proxy and setting the local quota limit to 40000MB:
168+
```
169+
CVMFS_HTTP_PROXY=DIRECT
170+
CVMFS_QUOTA_LIMIT=40000
171+
```
172+
For more details about configuring your client, see https://cvmfs.readthedocs.io/en/stable/cpt-configure.html.
173+
174+
Finally, run `cvmfs_config setup` to set up CVMFS.
175+
176+
*Admin note: for building the client configuration packages, see [this section](#building-the-cvmfs-configuration-packages).*
177+
149178
## Verification and usage
150179

151180
### Client
@@ -198,3 +227,12 @@ touch /cvmfs/pilot.eessi-hpc.org/testdir/testfile
198227
sudo cvmfs_server publish pilot.eessi-hpc.org
199228
```
200229
It might take a few minutes, but then the new file should show up at the clients.
230+
231+
232+
## Building the CVMFS configuration packages
233+
234+
For each push and pull request to the master branch, packages are automatically built by a Github Action.
235+
The resulting (unversioned) packages can be found as build artifacts on the page of each run of this action.
236+
When a new tag is created to mark a versioned release of the repository (e.g. `v1.2.3`, where the `v` is required!),
237+
the action builds a package with the same version number, creates a release, and stores the packages
238+
as release assets.

prepare-client-packages.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Prepare the input files for the Debian (deb) and Redhat (rpm) packages for CVMFS clients.
2+
---
3+
- name: Prepare Deb and RPM packages
4+
hosts: localhost
5+
vars:
6+
package_vendor: EESSI
7+
package_maintainer: EESSI <[email protected]>
8+
package_description: CVMFS config repository package for EESSI.
9+
package_source_dir: "{{ lookup('env', 'GITHUB_WORKSPACE') | default('/tmp', True) }}/package"
10+
tasks:
11+
- name: Create directory structure for the CVMFS config
12+
file:
13+
path: "{{ item }}"
14+
state: directory
15+
mode: 0775
16+
with_items:
17+
- "{{ package_source_dir }}"
18+
- "{{ package_source_dir }}/etc"
19+
- "{{ package_source_dir }}/etc/cvmfs"
20+
- "{{ package_source_dir }}/etc/cvmfs/keys"
21+
- "{{ package_source_dir }}/etc/cvmfs/keys/{{ eessi_cvmfs_config_repo.domain }}"
22+
- "{{ package_source_dir }}/etc/cvmfs/config.d"
23+
- "{{ package_source_dir }}/etc/cvmfs/default.d"
24+
25+
- name: Make EESSI CVMFS public key file
26+
copy:
27+
content: "{{ eessi_cvmfs_config_repo.key.key }}"
28+
dest: "{{ package_source_dir }}{{ eessi_cvmfs_config_repo.key.path }}"
29+
mode: 0644
30+
31+
- name: Make EESSI CVMFS configuration file
32+
copy:
33+
content: |
34+
CVMFS_SERVER_URL="{{ eessi_cvmfs_config_repo.urls|join(',') }}"
35+
CVMFS_PUBLIC_KEY="{{ eessi_cvmfs_config_repo.key.path }}"
36+
dest: "{{ package_source_dir }}/etc/cvmfs/config.d/{{ eessi_cvmfs_config_repo.repository.repository }}.conf"
37+
mode: 0644
38+
39+
- name: Make EESSI CVMFS default configuration file
40+
copy:
41+
content: |
42+
CVMFS_CONFIG_REPOSITORY="{{ eessi_cvmfs_config_repo.repository.repository }}"
43+
CVMFS_DEFAULT_DOMAIN="{{ eessi_cvmfs_config_repo.domain }}"
44+
dest: "{{ package_source_dir }}/etc/cvmfs/default.d/80-eessi-cvmfs.conf"
45+
mode: 0644

0 commit comments

Comments
 (0)