diff --git a/bundles/build-ci/metadata.py b/bundles/build-ci/metadata.py index 4d96f80..83c7b95 100644 --- a/bundles/build-ci/metadata.py +++ b/bundles/build-ci/metadata.py @@ -3,6 +3,7 @@ from shlex import quote @metadata_reactor.provides( 'users/build-ci/authorized_users', + 'sudoers/build-ci', ) def ssh_keys(metadata): return { diff --git a/bundles/build-server/files/ci b/bundles/build-server/files/ci index f3394c9..eaeee6b 100644 --- a/bundles/build-server/files/ci +++ b/bundles/build-server/files/ci @@ -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