Commit 226c8e08 authored by AlmAck's avatar AlmAck
Browse files

lock the repository for the whole upload process

will prevent that the CI fails in between of the operations and that results in an unknow state. The CI process can not restarted easly and a manual operation is required to fix it. With this fix, the CI process can be restarted if the db was locked.
parent c76726bb
......@@ -9,6 +9,10 @@ _do list_upload_packages
if [ -z "$UPLOAD_LIST" ]; then
_log success "Done nothing to upload!"
else
# lock the repository for the whole upload process to prevent
# the CI to fail in between of the operations
_do _lock_repo
# sanity check
_do check-upload
# rsync upload
......@@ -18,5 +22,6 @@ else
# sign the remote database
_do sign_database $(get_repository)
_do _unlock_repo
_log success "Done uploading!"
fi
......@@ -83,9 +83,7 @@ function _upload_files() {
function upload_files() {
_do _set_deploy_repo $1
_log build_step "Start uploading to [$DEPLOY_REPO] the following packages: ${UPLOAD_LIST[@]}"
_do _lock_repo
_do_deploy _upload_files "${UPLOAD_LIST[@]}"
_do _unlock_repo
_log success "rsync upload done"
}
......@@ -93,10 +91,8 @@ function update_remote_db() {
_log build_step "Start importing pkgs with akbm"
local -a file_names=( ${UPLOAD_LIST[@]##*/} )
_do _lock_repo
# we can no use _do in this case, because we have to parse the output to know if was successfully executed
_do_akbm ssh "$SSH_USER@$DEPLOY_SERVER" -p "$SSH_PORT" "akbm --repo-name $DEPLOY_REPO --arch x86_64 --repo-add" "${file_names[@]}"
_do _unlock_repo
}
function check-upload() {
......@@ -118,12 +114,10 @@ function sign_database() {
echo "$GPG_PASSWORD" | gpg -sb --pinentry-mode loopback --passphrase-fd 0 "$dir/$DEPLOY_REPO.db.tar.gz"
_do _set_deploy_repo $1
_do _lock_repo
DB_UPLOAD_LIST=( $(set -o noglob; find $dir -name '*.db.tar.*' \( $(_find_args ${args[@]}) \) -print) )
_log build_step "Start uploading to [$DEPLOY_REPO] the following files ${DB_UPLOAD_LIST[@]}"
_do_deploy _upload_files "${DB_UPLOAD_LIST[@]}"
_do _unlock_repo
_do rm -rfv $dir
_log success "Database signature done"
}
......
......@@ -20,10 +20,15 @@ else
source_repo="testing"
fi
# lock the repository for the whole move process to prevent
# the CI to fail in between of the operations
_do _lock_repo
_do move_pkgs $source_repo $DEST_REPO
# sign the remote databases
_do sign_database $source_repo
_do sign_database $DEST_REPO
_do _unlock_repo
_log success "Done uploading!"
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment