ci tidyup more

This commit is contained in:
mwiegand 2022-03-13 18:30:13 +01:00
parent 09ca6bddf6
commit 041098ecde
2 changed files with 8 additions and 6 deletions

View file

@ -3,6 +3,7 @@ from shlex import quote
@metadata_reactor.provides(
'users/build-ci/authorized_users',
'sudoers/build-ci',
)
def ssh_keys(metadata):
return {

View file

@ -14,16 +14,17 @@ do
[[ $(jq -r '.repo' <<< $INTEGRATION) = $REPO_NAME ]] || continue
HOSTNAME=$(jq -r '.hostname' <<< $INTEGRATION)
DESTINATION_PATH=$(jq -r '.path' <<< $INTEGRATION)
DESTINATION_GROUP=$(jq -r '.group' <<< $INTEGRATION)
DEST_PATH=$(jq -r '.path' <<< $INTEGRATION)
DEST_GROUP=$(jq -r '.group' <<< $INTEGRATION)
DEST_MODE=$(jq -r '.mode' <<< $INTEGRATION)
[[ -z "$HOSTNAME" ]] || [[ -z "$DESTINATION_PATH" ]] || [[ -z "$DESTINATION_GROUP" ]] && exit 5
[[ -z "$HOSTNAME" ]] || [[ -z "$DEST_PATH" ]] || [[ -z "$DEST_GROUP" ]] || [[ -z "$DEST_MODE" ]] && exit 5
cd ~
rm -rf "$REPO_NAME"
git clone "$CLONE_URL" "$REPO_NAME"
ssh $SSH_OPTIONS "build-ci@$HOSTNAME" "find \"$DESTINATION_PATH\" -mindepth 1 -delete"
scp -r $SSH_OPTIONS "$REPO_NAME"/* "build-ci@$HOSTNAME:$DESTINATION_PATH"
ssh $SSH_OPTIONS "build-ci@$HOSTNAME" "sudo chown -R build-ci:$DESTINATION_GROUP $(printf "%q" "$DESTINATION_PATH")"
ssh $SSH_OPTIONS "build-ci@$HOSTNAME" "find \"$DEST_PATH\" -mindepth 1 -delete"
scp -r $SSH_OPTIONS "$REPO_NAME"/* "build-ci@$HOSTNAME:$DEST_PATH"
ssh $SSH_OPTIONS "build-ci@$HOSTNAME" "sudo chown -R build-ci:$DEST_GROUP $(printf "%q" "$DEST_PATH")"
done