-
Notifications
You must be signed in to change notification settings - Fork 27
145 lines (125 loc) · 5.31 KB
/
check-cvmfs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---
# Check commits and incoming PRs that change scripts under cvmfs/.
name: Check CVMFS scripts
'on':
push:
paths:
- 'cvmfs/**'
pull_request:
paths:
- 'cvmfs/**'
types:
- opened
- reopened
- edited
- ready_for_review
- synchronize
permissions: {}
jobs:
alienv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
sudo apt update -y
# python-ldap needs lib{ldap,sasl}2-dev
sudo apt install -y libldap2-dev libsasl2-dev \
build-essential bison texinfo environment-modules \
python3-dev python3-pip python3-setuptools python3-wheel
python3 -m pip install -r requirements.txt
- name: Install an old bash
run: |
# Install and configure an old bash
rm -rf ~/cached ~/scratch
mkdir -p ~/cached ~/scratch
curl -fSsL https://ftp.gnu.org/gnu/bash/bash-3.2.48.tar.gz |
tar -xzC ~/scratch
pushd ~/scratch/bash-3.2.48
./configure "--prefix=$HOME/cached"
make -j4
make install
popd
# Patch alienv and make it use our own, old, bash
sed -i "1s|^#\!/bin/bash|#\!$HOME/cached/bin/bash|" cvmfs/alienv
git --no-pager diff
- name: Install CVMFS
run: |
# Install and configure CVMFS
url=https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb
wget -q "$url" || case $? in
5) wget --no-check-certificate -q "$url";;
*) exit 1;;
esac
unset url
sudo dpkg -i cvmfs-release-latest_all.deb
rm -f cvmfs-release-latest_all.deb
sudo apt update -y
sudo apt install -y cvmfs-dev cvmfs libtcl8.6 libx11-6
sudo mkdir -p /cvmfs/alice.cern.ch
sudo chown -R cvmfs:cvmfs /cvmfs
echo CVMFS_HTTP_PROXY=DIRECT | sudo tee /etc/cvmfs/default.local
sudo mount alice.cern.ch /cvmfs/alice.cern.ch -t cvmfs -o allow_other,grab_mountpoint
ls -l /cvmfs/alice.cern.ch
# Override remote alienv with ours
md5sum /cvmfs/alice.cern.ch/bin/alienv
md5sum "$PWD/cvmfs/alienv"
sudo mount --bind "$PWD/cvmfs/alienv" /cvmfs/alice.cern.ch/bin/alienv
md5sum /cvmfs/alice.cern.ch/bin/alienv
cmp /cvmfs/alice.cern.ch/bin/alienv "$PWD/cvmfs/alienv"
- name: Test alienv script
run: |
# Run the actual test
set -exo pipefail
pe () { printf '\033[31mERROR:\033[m %s\n' "$@" >&2; exit 1; }
pi () { printf '\033[34mINFO:\033[m %s\n' "$@" >&2; }
pt () { printf '\n\033[35m*** TEST: %s ***\033[m\n' "$@" >&2; }
pg () { printf '\033[32mSUCCESS:\033[m %s\n' "$@" >&2; }
# Check if required conditions to run the test are met
[ -d .git ] || pe "you must run from the Git repository root"
# We normally test `alienv` faked as being on CVMFS. For local tests
# we might want to override it
ALIENV=/cvmfs/alice.cern.ch/bin/alienv
pi "Testing alienv from $ALIENV"
tag=AliPhysics/v5-09-59r-01_O2-1
# Overriding platform (not important for our tests)
export ALIENV_OVERRIDE_PLATFORM=el7
pi "Overriding platform to $ALIENV_OVERRIDE_PLATFORM"
for np in /tmp/alienv_bin /tmp/alienv_path/bin; do
pt "run alienv from a non-standard path ($np) with full symlink"
( mkdir -p "$np"
ln -nfs "$ALIENV" "$np/alienv"
# shellcheck disable=SC2030
export PATH=$np:$PATH
ALIENV_DEBUG=1 alienv printenv "$tag"
) || exit $?
done
np=/tmp/alienv_symlink/bin
pt "run alienv from a non-standard path ($np) with relative symlink"
( mkdir -p "$np"
ln -nfs "$(dn=$(dirname "$ALIENV"); while [ "$dn" != / ]; do dn=$(dirname "$dn"); printf ../; done)$ALIENV" "$np/alienv"
# shellcheck disable=SC2030,SC2031
export PATH=$np:$PATH
ALIENV_DEBUG=1 alienv printenv "$tag"
) || exit $?
unset np
# shellcheck disable=SC2031
PATH=$(dirname "$ALIENV"):$PATH
export PATH
[ "$(command -v alienv)" = "$ALIENV" ]
pt "test package reordering"
(ALIENV_DEBUG=1 alienv setenv "VO_ALICE@AliEn-Runtime::v2-19-le-143,VO_ALICE@ROOT::v6-28-04-alice3-5,$tag" -c true 2>&1 || :) |
tee /dev/stderr |
grep 'normalized to AliPhysics/v5-09-59r-01_O2-1 ROOT/v6-28-04-alice3-5 AliEn-Runtime/v2-19-le-143'
pt "test checkenv command with a successful combination"
alienv checkenv "$tag,AliRoot/$(basename "$tag" | sed 's/-01//')" ||
pe "expected 0, returned $?"
pt "test checkenv command with a faulty combination"
if alienv checkenv "$tag,AliPhysics/vAN-20240214_O2-1" 2>&1; then
pe "expected failure, returned $?"
fi | grep -q 'conflicting version' ||
pe "could not find expected output message"
# "alienv q" takes too long in a GitHub workflow (>45 min).
# pt "list AliPhysics packages"
# alienv q | grep AliPhysics | tail -n5
pg "all tests successful"