dev/sg: add 'sg run server' alias (#38256)

Convenient for running end-to-end tests the same way we run them in CI.
This commit is contained in:
Robert Lin 2022-07-06 10:09:41 -07:00 committed by GitHub
parent a79eba4791
commit da23651ade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View File

@ -2,7 +2,8 @@
# This runs a published or local server image for testing and development purposes.
IMAGE=${IMAGE:-sourcegraph/server:${TAG:-insiders}}
URL=${URL:-"http://localhost:7080"}
PORT=${PORT:-"7080"}
URL="http://localhost:$PORT"
DATA=${DATA:-"/tmp/sourcegraph-data"}
echo "--- Checking for existing Sourcegraph instance at $URL"
@ -31,9 +32,9 @@ if [ "$clean" != "n" ] && [ "$clean" != "N" ]; then
rm -rf "$DATA"
fi
echo "--- Starting server ${IMAGE}"
echo "--- Starting server ${IMAGE} on port ${PORT}"
docker run "$@" \
--publish 7080:7080 \
--publish "$PORT":7080 \
-e SRC_LOG_LEVEL=dbug \
-e DEBUG=t \
--volume "$DATA/config:/etc/sourcegraph" \

View File

@ -108,6 +108,7 @@ Available commands in `sg.config.yaml`:
* redis-postgres
* repo-updater
* searcher
* server
* storybook
* symbols
* syntax-highlighter

View File

@ -115,6 +115,14 @@ env:
ENABLE_STREAMING_REPOS_SYNCER: true
commands:
server:
cmd: ./dev/run-server-image.sh
env:
TAG: insiders
CLEAN: 'true'
DATA: '/tmp/sourcegraph-data'
URL: 'http://localhost:7080'
oss-frontend:
cmd: .bin/oss-frontend
install: |
@ -964,7 +972,10 @@ tests:
frontend-e2e:
preamble: |
'sg start enterprise-e2e' must be already running for these tests to work.
'sg start enterprise-e2e' must be already running for these tests to work. You can also
run tests against an existing server image:
TAG=insiders sg run server
If you run into authentication issues, you can run the following commands to fix them: