Merge pull request #8135 from dokku/8093-client-remote-parsing
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
export DOKKU_PORT=${DOKKU_PORT:=22}
|
export DOKKU_PORT=${DOKKU_PORT:=}
|
||||||
export DOKKU_HOST=${DOKKU_HOST:=}
|
export DOKKU_HOST=${DOKKU_HOST:=}
|
||||||
|
export DOKKU_APP_PATH=${DOKKU_APP_PATH:=}
|
||||||
|
|
||||||
fn-random-number() {
|
fn-random-number() {
|
||||||
[[ -n "$1" ]] && RANGE="$1"
|
[[ -n "$1" ]] && RANGE="$1"
|
||||||
@@ -61,12 +62,42 @@ fn-dokku-host() {
|
|||||||
echo "$DOKKU_HOST"
|
echo "$DOKKU_HOST"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn-dokku-app() {
|
||||||
|
declare DOKKU_GIT_REMOTE="$1" DOKKU_REMOTE_HOST="$2"
|
||||||
|
remote_output="$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | head -n 1 | awk '{print $2}')"
|
||||||
|
|
||||||
|
# check if there is a scheme
|
||||||
|
if echo "$remote_output" | grep -qEi "ssh://"; then
|
||||||
|
echo "$remote_output" | grep -Ei "ssh://dokku@$DOKKU_REMOTE_HOST" | cut -f2 -d'@' | cut -f2 -d'/' 2>/dev/null
|
||||||
|
else
|
||||||
|
echo "$remote_output" | grep -Ei "dokku@$DOKKU_REMOTE_HOST" | cut -f2 -d'@' | cut -f2 -d':' 2>/dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fn-dokku-port() {
|
||||||
|
declare DOKKU_GIT_REMOTE="$1" DOKKU_REMOTE_HOST="$2"
|
||||||
|
remote_output="$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | head -n 1 | awk '{print $2}')"
|
||||||
|
|
||||||
|
if echo "$remote_output" | grep -qEi "ssh://"; then
|
||||||
|
local output="$(echo "$remote_output" | grep -Ei "ssh://dokku@$DOKKU_REMOTE_HOST" | cut -f2 -d'@' | cut -f1 -d'/' 2>/dev/null)"
|
||||||
|
# check if output has a : and if so, get the port
|
||||||
|
if echo "$output" | grep -qEi ":"; then
|
||||||
|
echo "$output" | cut -f2 -d':' 2>/dev/null
|
||||||
|
else
|
||||||
|
echo "22"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "22"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
fn-get-remote() {
|
fn-get-remote() {
|
||||||
git config dokku.remote 2>/dev/null || echo "dokku"
|
git config dokku.remote 2>/dev/null || echo "dokku"
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
declare CMD="$1" APP_ARG="$2"
|
declare CMD="$1" APP_ARG="$2"
|
||||||
|
|
||||||
local APP="" DOKKU_GIT_REMOTE="$(fn-get-remote)" DOKKU_REMOTE_HOST=""
|
local APP="" DOKKU_GIT_REMOTE="$(fn-get-remote)" DOKKU_REMOTE_HOST=""
|
||||||
local cmd_set=false next_index=1 skip=false args=("$@")
|
local cmd_set=false next_index=1 skip=false args=("$@")
|
||||||
|
|
||||||
@@ -84,6 +115,10 @@ main() {
|
|||||||
APP=${args[$next_index]}
|
APP=${args[$next_index]}
|
||||||
skip=true
|
skip=true
|
||||||
shift 2
|
shift 2
|
||||||
|
elif [[ "$arg" == "--app-path" ]]; then
|
||||||
|
DOKKU_APP_PATH=${args[$next_index]}
|
||||||
|
skip=true
|
||||||
|
shift 2
|
||||||
elif [[ "$arg" == "--remote" ]]; then
|
elif [[ "$arg" == "--remote" ]]; then
|
||||||
DOKKU_GIT_REMOTE=${args[$next_index]}
|
DOKKU_GIT_REMOTE=${args[$next_index]}
|
||||||
skip=true
|
skip=true
|
||||||
@@ -103,6 +138,11 @@ main() {
|
|||||||
next_index=$((next_index + 1))
|
next_index=$((next_index + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ -n "$DOKKU_APP_PATH" ]]; then
|
||||||
|
pushd "$DOKKU_APP_PATH" &>/dev/null || exit 1
|
||||||
|
trap 'popd &>/dev/null || true' RETURN INT TERM
|
||||||
|
fi
|
||||||
|
|
||||||
DOKKU_REMOTE_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")"
|
DOKKU_REMOTE_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")"
|
||||||
if [[ -z "$DOKKU_REMOTE_HOST" ]] && [[ "$CMD" != remote ]] && [[ "$CMD" != remote:* ]]; then
|
if [[ -z "$DOKKU_REMOTE_HOST" ]] && [[ "$CMD" != remote ]] && [[ "$CMD" != remote:* ]]; then
|
||||||
fn-client-help-msg
|
fn-client-help-msg
|
||||||
@@ -111,14 +151,28 @@ main() {
|
|||||||
if [[ -z "$APP" ]]; then
|
if [[ -z "$APP" ]]; then
|
||||||
if [[ -d .git ]] || git rev-parse --git-dir &>/dev/null; then
|
if [[ -d .git ]] || git rev-parse --git-dir &>/dev/null; then
|
||||||
set +e
|
set +e
|
||||||
APP=$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | grep -Ei "dokku@$DOKKU_REMOTE_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
APP="$(fn-dokku-app "$DOKKU_GIT_REMOTE" "$DOKKU_REMOTE_HOST")"
|
||||||
set -e
|
set -e
|
||||||
else
|
else
|
||||||
echo " ! This is not a git repository" 1>&2
|
echo " ! This is not a git repository" 1>&2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$DOKKU_PORT" ]]; then
|
||||||
|
DOKKU_PORT="$(fn-dokku-port "$DOKKU_GIT_REMOTE" "$DOKKU_REMOTE_HOST")"
|
||||||
|
fi
|
||||||
|
|
||||||
case "$CMD" in
|
case "$CMD" in
|
||||||
|
remote:show)
|
||||||
|
echo "dokku-app: $APP"
|
||||||
|
echo "dokku-git-remote: $DOKKU_GIT_REMOTE"
|
||||||
|
echo "dokku-host: $DOKKU_HOST"
|
||||||
|
echo "dokku-port: $DOKKU_PORT"
|
||||||
|
echo "dokku-remote-host: $DOKKU_REMOTE_HOST"
|
||||||
|
echo "dokku-ssh-user: dokku"
|
||||||
|
echo "dokku-constructed-remote: ssh://dokku@$DOKKU_REMOTE_HOST:$DOKKU_PORT/$APP"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
apps:create)
|
apps:create)
|
||||||
if [[ -z "$APP" ]] && [[ -z "$APP_ARG" ]]; then
|
if [[ -z "$APP" ]] && [[ -z "$APP_ARG" ]]; then
|
||||||
APP=$(fn-random-name)
|
APP=$(fn-random-name)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ All commands have the application name automatically set via the `--app` flag on
|
|||||||
|
|
||||||
The client supports several environment variables:
|
The client supports several environment variables:
|
||||||
|
|
||||||
- `DOKKU_HOST` (default: `dokku` git remote): Used to interact with a specific remote server. Can be overridden via the `--remote` flag.
|
- `DOKKU_HOST` (default: `dokku` git remote): Used to interact with a specific remote server. Can be overridden via the `--remote` flag. Must specify the `--app` flag when specified.
|
||||||
- `DOKKU_PORT` (default: `22`): Used to specify a port to connect to the Dokku server on.
|
- `DOKKU_PORT` (default: `22`): Used to specify a port to connect to the Dokku server on.
|
||||||
|
|
||||||
It also supports several flags (all flags unspecified here are passed as is to the server):
|
It also supports several flags (all flags unspecified here are passed as is to the server):
|
||||||
@@ -99,6 +99,12 @@ To list all available remotes, run `dokku remote:list`. This is equivalent to ru
|
|||||||
|
|
||||||
To add a remote, run `dokku remote:add $REMOTE_NAME dokku@dokku.me:$APP_NAME`, replacing `$REMOTE_NAME` with your desired remote name, the `$APP_NAME` with your desired app name and the host `dokku.me` with your Dokku host. This is equivalent to running `git remote add $REMOTE_NAME dokku@dokku.me:$APP_NAME`.
|
To add a remote, run `dokku remote:add $REMOTE_NAME dokku@dokku.me:$APP_NAME`, replacing `$REMOTE_NAME` with your desired remote name, the `$APP_NAME` with your desired app name and the host `dokku.me` with your Dokku host. This is equivalent to running `git remote add $REMOTE_NAME dokku@dokku.me:$APP_NAME`.
|
||||||
|
|
||||||
|
The following remote formats are supported:
|
||||||
|
|
||||||
|
- `dokku@HOSTNAME.TLD:APP_NAME`
|
||||||
|
- `ssh://dokku@HOSTNAME.TLD/APP_NAME`
|
||||||
|
- `ssh://dokku@HOSTNAME.TLD:HOST_PORT/APP_NAME`
|
||||||
|
|
||||||
To remove a remote, run `dokku remote:remove $REMOTE_NAME`. This is equivalent to running `git remote remove $REMOTE_NAME`.
|
To remove a remote, run `dokku remote:remove $REMOTE_NAME`. This is equivalent to running `git remote remove $REMOTE_NAME`.
|
||||||
|
|
||||||
By default, the remote in use is `dokku`. To change the remote the client uses by default, run `dokku remote:set $REMOTE_NAME`, where `$REMOTE_NAME` is the name of your desired remote. This will not check the value specified, so that remote *must* be available or errors will occur when running normal client commands. Note that specifying `--remote` when running dokku commands will override this configuration value.
|
By default, the remote in use is `dokku`. To change the remote the client uses by default, run `dokku remote:set $REMOTE_NAME`, where `$REMOTE_NAME` is the name of your desired remote. This will not check the value specified, so that remote *must* be available or errors will occur when running normal client commands. Note that specifying `--remote` when running dokku commands will override this configuration value.
|
||||||
|
|||||||
@@ -24,6 +24,137 @@ teardown() {
|
|||||||
assert_exit_status 20
|
assert_exit_status 20
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "(client) remote:show" {
|
||||||
|
unset DOKKU_HOST
|
||||||
|
local DOKKU_APP_PATH=$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")
|
||||||
|
trap 'popd &>/dev/null || true; rm -rf "$DOKKU_APP_PATH"' INT TERM
|
||||||
|
|
||||||
|
setup_client_repo "$DOKKU_APP_PATH"
|
||||||
|
export DOKKU_APP_PATH="$DOKKU_APP_PATH"
|
||||||
|
|
||||||
|
# handle simple remote: dokku@example.com:app-name
|
||||||
|
run /bin/bash -c "git -C "$DOKKU_APP_PATH" remote add dokku 'dokku@example.com:$TEST_APP'"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "DOKKU_APP_PATH=$DOKKU_APP_PATH ${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:show"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "dokku-app: $TEST_APP"
|
||||||
|
assert_output_contains "dokku-git-remote: dokku"
|
||||||
|
assert_output_not_contains "dokku-host: example.com"
|
||||||
|
assert_output_not_contains "dokku-host: example.net"
|
||||||
|
assert_output_contains "dokku-host: "
|
||||||
|
assert_output_contains "dokku-port: 22"
|
||||||
|
assert_output_contains "dokku-remote-host: example.com"
|
||||||
|
assert_output_contains "dokku-ssh-user: dokku"
|
||||||
|
assert_output_contains "dokku-constructed-remote: ssh://dokku@example.com:22/$TEST_APP"
|
||||||
|
|
||||||
|
# handle custom DOKKU_HOST (no app name detected without --app flag)
|
||||||
|
run /bin/bash -c "DOKKU_HOST="example.net" DOKKU_APP_PATH=$DOKKU_APP_PATH ${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:show"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_not_contains "dokku-app: $TEST_APP"
|
||||||
|
assert_output_contains "dokku-git-remote: dokku"
|
||||||
|
assert_output_contains "dokku-host: example.net"
|
||||||
|
assert_output_contains "dokku-port: 22"
|
||||||
|
assert_output_contains "dokku-remote-host: example.net"
|
||||||
|
assert_output_contains "dokku-ssh-user: dokku"
|
||||||
|
assert_output_contains "dokku-constructed-remote: ssh://dokku@example.net:22/"
|
||||||
|
assert_output_not_contains "dokku-constructed-remote: ssh://dokku@example.net:22/$TEST_APP"
|
||||||
|
|
||||||
|
# handle custom DOKKU_HOST (app name detected with --app flag)
|
||||||
|
run /bin/bash -c "DOKKU_HOST="example.net" DOKKU_APP_PATH=$DOKKU_APP_PATH ${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:show --app $TEST_APP"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "dokku-app: $TEST_APP"
|
||||||
|
assert_output_contains "dokku-git-remote: dokku"
|
||||||
|
assert_output_contains "dokku-host: example.net"
|
||||||
|
assert_output_contains "dokku-port: 22"
|
||||||
|
assert_output_contains "dokku-remote-host: example.net"
|
||||||
|
assert_output_contains "dokku-ssh-user: dokku"
|
||||||
|
assert_output_contains "dokku-constructed-remote: ssh://dokku@example.net:22/$TEST_APP"
|
||||||
|
|
||||||
|
# handle custom DOKKU_PORT
|
||||||
|
run /bin/bash -c "DOKKU_PORT=2222 DOKKU_APP_PATH=$DOKKU_APP_PATH ${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:show"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "dokku-app: $TEST_APP"
|
||||||
|
assert_output_contains "dokku-git-remote: dokku"
|
||||||
|
assert_output_not_contains "dokku-host: example.com"
|
||||||
|
assert_output_not_contains "dokku-host: example.net"
|
||||||
|
assert_output_contains "dokku-host: "
|
||||||
|
assert_output_contains "dokku-port: 2222"
|
||||||
|
assert_output_contains "dokku-remote-host: example.com"
|
||||||
|
assert_output_contains "dokku-ssh-user: dokku"
|
||||||
|
assert_output_contains "dokku-constructed-remote: ssh://dokku@example.com:2222/$TEST_APP"
|
||||||
|
|
||||||
|
# handle remote with scheme (no port): ssh://dokku@example.com/app-name
|
||||||
|
run /bin/bash -c "git -C "$DOKKU_APP_PATH" remote set-url dokku 'ssh://dokku@example.com:22/$TEST_APP'"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "DOKKU_APP_PATH=$DOKKU_APP_PATH ${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:show"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "dokku-app: $TEST_APP"
|
||||||
|
assert_output_contains "dokku-git-remote: dokku"
|
||||||
|
assert_output_not_contains "dokku-host: example.com"
|
||||||
|
assert_output_not_contains "dokku-host: example.net"
|
||||||
|
assert_output_contains "dokku-host: "
|
||||||
|
assert_output_contains "dokku-port: 22"
|
||||||
|
assert_output_contains "dokku-remote-host: example.com"
|
||||||
|
assert_output_contains "dokku-ssh-user: dokku"
|
||||||
|
assert_output_contains "dokku-constructed-remote: ssh://dokku@example.com:22/$TEST_APP"
|
||||||
|
|
||||||
|
# handle remote with scheme (with port): ssh://dokku@example.com:2222/app-name
|
||||||
|
run /bin/bash -c "git -C "$DOKKU_APP_PATH" remote set-url dokku 'ssh://dokku@example.com:2222/$TEST_APP'"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "DOKKU_APP_PATH=$DOKKU_APP_PATH ${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:show"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "dokku-app: $TEST_APP"
|
||||||
|
assert_output_contains "dokku-git-remote: dokku"
|
||||||
|
assert_output_not_contains "dokku-host: example.com"
|
||||||
|
assert_output_not_contains "dokku-host: example.net"
|
||||||
|
assert_output_contains "dokku-host: "
|
||||||
|
assert_output_contains "dokku-port: 2222"
|
||||||
|
assert_output_contains "dokku-remote-host: example.com"
|
||||||
|
assert_output_contains "dokku-ssh-user: dokku"
|
||||||
|
assert_output_contains "dokku-constructed-remote: ssh://dokku@example.com:2222/$TEST_APP"
|
||||||
|
|
||||||
|
# #8093: ssh://dokku@pipescan.shipit.dev:2222/pipescan
|
||||||
|
run /bin/bash -c "git -C "$DOKKU_APP_PATH" remote set-url dokku 'ssh://dokku@pipescan.shipit.dev:2222/pipescan'"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "DOKKU_APP_PATH=$DOKKU_APP_PATH ${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh remote:show"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "dokku-app: pipescan"
|
||||||
|
assert_output_contains "dokku-git-remote: dokku"
|
||||||
|
assert_output_not_contains "dokku-host: example.com"
|
||||||
|
assert_output_not_contains "dokku-host: example.net"
|
||||||
|
assert_output_contains "dokku-host: "
|
||||||
|
assert_output_contains "dokku-port: 2222"
|
||||||
|
assert_output_contains "dokku-remote-host: pipescan.shipit.dev"
|
||||||
|
assert_output_contains "dokku-ssh-user: dokku"
|
||||||
|
assert_output_contains "dokku-constructed-remote: ssh://dokku@pipescan.shipit.dev:2222/pipescan"
|
||||||
|
}
|
||||||
|
|
||||||
@test "(client) no args should print help" {
|
@test "(client) no args should print help" {
|
||||||
# dokku container is not run with a TTY on GitHub Actions so we don't get normal output
|
# dokku container is not run with a TTY on GitHub Actions so we don't get normal output
|
||||||
# https://github.com/actions/runner/issues/241
|
# https://github.com/actions/runner/issues/241
|
||||||
@@ -332,3 +463,16 @@ teardown() {
|
|||||||
assert_success
|
assert_success
|
||||||
assert_output_contains "triggered smoke-test-plugin:args with args: smoke-test-plugin:args, bash, -c, echo Hello"
|
assert_output_contains "triggered smoke-test-plugin:args with args: smoke-test-plugin:args, bash, -c, echo Hello"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setup_client_repo() {
|
||||||
|
declare TMP="${1:-$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")}"
|
||||||
|
rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/nodejs-express" "$TMP"
|
||||||
|
cd "$TMP" || exit 1
|
||||||
|
git init
|
||||||
|
git config user.email "robot@example.com"
|
||||||
|
git config user.name "Test Robot"
|
||||||
|
|
||||||
|
[[ -f gitignore ]] && mv gitignore .gitignore
|
||||||
|
git add .
|
||||||
|
git commit -m 'initial commit'
|
||||||
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ assert_output_contains() {
|
|||||||
input="${input/$expected/}"
|
input="${input/$expected/}"
|
||||||
found=$((found + 1))
|
found=$((found + 1))
|
||||||
done
|
done
|
||||||
assert_equal "$count" "$found"
|
[[ "$count" -eq "$found" ]] || flunk "expected $count occurrences of '$expected', found $found"
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_output_not_contains() {
|
assert_output_not_contains() {
|
||||||
@@ -374,20 +374,6 @@ deploy_app() {
|
|||||||
git push target "master:${GIT_REMOTE_BRANCH}" || destroy_app $?
|
git push target "master:${GIT_REMOTE_BRANCH}" || destroy_app $?
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_client_repo() {
|
|
||||||
local TMP
|
|
||||||
TMP=$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")
|
|
||||||
rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/nodejs-express" "$TMP"
|
|
||||||
cd "$TMP" || exit 1
|
|
||||||
git init
|
|
||||||
git config user.email "robot@example.com"
|
|
||||||
git config user.name "Test Robot"
|
|
||||||
|
|
||||||
[[ -f gitignore ]] && mv gitignore .gitignore
|
|
||||||
git add .
|
|
||||||
git commit -m 'initial commit'
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_test_tls() {
|
setup_test_tls() {
|
||||||
local TLS_TYPE="$1"
|
local TLS_TYPE="$1"
|
||||||
local TLS="/home/dokku/$TEST_APP/tls"
|
local TLS="/home/dokku/$TEST_APP/tls"
|
||||||
|
|||||||
Reference in New Issue
Block a user