forked from adriennesolange/clpipe_readthedocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_clpipe.sh
86 lines (64 loc) · 1.92 KB
/
deploy_clpipe.sh
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
# Deployment script
# UNC-specific but can be adapted for other clusters with a module system
# Run like this, where x.y.z is the version:
# source deploy_clpipe.sh x.y.z
DEV_PYTHON_PATH="venv/bin/activate"
PYTHON_VERSION="3.7.14"
DEPLOY_ROOT="/proj/hng/software"
MODULE_ROOT="${DEPLOY_ROOT}/modules/clpipe"
VENVS="${DEPLOY_ROOT}/venvs/clpipe"
if [ $# -eq 0 ]
then
echo "1st argument required: version"
exit 1
fi
version=$1
default=$2
# Ensure dev env is loaded
source $DEV_PYTHON_PATH
# Run build script
source build_clpipe.sh
echo "Deploying version ${version}"
venv_path="${VENVS}/clpipe-${version}"
# Turn off dev virtual environment
deactivate
# Remove prior venv if needed
echo "Removing any prior virtual environment with same version"
rm -rf $venv_path
# Add a new venv for this release
module purge
module add "python/${PYTHON_VERSION}"
echo "Creating virtual environment at: ${venv_path}"
python -m venv $venv_path
module purge
source "${venv_path}/bin/activate"
echo "Updating pip"
pip install -U pip
echo "Installing wheel"
pip install wheel
echo "Installing clpipe"
pip install "dist/clpipe-${version}-py3-none-any.whl"
# Build bash auto-completion script
echo "Building auto-completion bash script"
source generate_autocomplete
# Deploy auto-completion script
echo "Deploying auto-completion bash script"
cp dist/.clpipe-complete "${venv_path}/bin"
echo "Deployment complete"
# Turn off the deployment venv
deactivate
# Turn back on the dev venv
source $DEV_PYTHON_PATH
# Build the module file
python .lmod/build_module_file.py
# Deploy the module file
echo "Deploying module file as ${MODULE_ROOT}/${version}.lua"
cp "dist/${version}.lua" ${MODULE_ROOT}
# Open group execute on lua file
chmod 750 "${MODULE_ROOT}/${version}.lua"
# Set this module file as default via symlink
if [ $default = "default" ];
then
echo "Setting module file as clpipe default"
(cd ${MODULE_ROOT}; ln -sf "${version}.lua" default)
fi;