Skip to content
Snippets Groups Projects

.gitlab-ci: deploy via copy and symlink switcheroo

2 files
+ 27
8
Compare changes
  • Side-by-side
  • Inline
Files
2
  • During analysis on Maxwell, for one of the jobs we saw error messages
    indicating that "libmsgpack.so" and some xgandalf precomputed files
    weren't found. The cause must have been a partial update that was
    being made by the deployment script.
    
    To fix it, we now copy and rename, instead of renaming and then
    copying.
+ 26
0
#!/usr/bin/env bash
set -euo pipefail
MAXWELL_USER_NAME="$1"
MAXWELL_HOST="$2"
PREFIX="$3"
BASE_REMOTE_DIR="/software/crystfel"
CURRENT_TARGET_DIR="$BASE_REMOTE_DIR/devel-$(date +%F-%H:%M:%S)"
# To avoid people starting CrystFEL devel processes while those are
# being redeployed (leading to weird error messages), we copy first,
# and then atomically switch a symlink (see "mv -T" below) so we have
# minimal overlap time.
scp -r "$PREFIX/crystfel/devel" "${MAXWELL_USER_NAME}@${MAXWELL_HOST}:$CURRENT_TARGET_DIR"
ssh "${MAXWELL_USER_NAME}@${MAXWELL_HOST}" <<EOF
set -euo pipefail
rm -f "$BASE_REMOTE_DIR/crystfel-deployment-temp"
ln -s "$CURRENT_TARGET_DIR" "$BASE_REMOTE_DIR/crystfel-deployment-temp"
mv -T "$BASE_REMOTE_DIR/crystfel-deployment-temp" "$BASE_REMOTE_DIR/devel"
EOF
Loading