Skip to content
Snippets Groups Projects
Commit f8bf96ba authored by Philipp Middendorf's avatar Philipp Middendorf
Browse files

.gitlab-ci: deploy via copy and symlink switcheroo

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.
parent b1d48769
No related branches found
No related tags found
1 merge request!45.gitlab-ci: deploy via copy and symlink switcheroo
This commit is part of merge request !45. Comments created here will be created in the context of that merge request.
......@@ -150,14 +150,7 @@ deploy-remote-maxwell:
fi
script:
- ssh $MAXWELL_USER_NAME@$HOST
"if [ -d /software/crystfel/devel ]; then
mv -f /software/crystfel/devel /software/crystfel/devel-`date +%F-%H:%M:%S`;
else if [ ! -d /software/crystfel/ ]; then
mkdir -p /software/crystfel/;
fi;
fi"
- scp -r $PREFIX/crystfel/devel $MAXWELL_USER_NAME@$HOST:/software/crystfel/
- deployment/deploy-to-maxwell.sh "$MAXWELL_USER_NAME" "$HOST" "$PREFIX"
rules:
- if: $CI_COMMIT_BRANCH == "master"
......
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment