mirror of
https://github.com/RustyRaptor/deploy-sourcegraph-docker.git
synced 2026-12-05 08:45:20 -07:00
CI Test improvements, fixes (#833)
* Don’t exit early if docker ps failed * Remove temporary sed command used during timescale migration * Update expected container counts * Fix missing variable * Add timeout to docker-compose up command * Upgrade caddy in 2.5.1 * Add timeout to pure-docker deployment * Don’t start deployment in preparation to start deployment?
This commit is contained in:
1 parent
3783cd1008
commit
f5b45da29f
4 files changed
+9
-20
No files matched your search
@@ -32,5 +32,5 @@ docker run --detach \
|
||||
-p 0.0.0.0:443:443 \
|
||||
-v $VOLUME:/caddy-storage \
|
||||
--mount type=bind,source="$(pwd)"/../caddy/builtins/http.Caddyfile,target=/etc/caddy/Caddyfile \
|
||||
index.docker.io/caddy:2.4.6-alpine@sha256:b5a59725783bab0d65803f87028c68dd6611ca6184040bd98b18797cbe26bdd9
|
||||
index.docker.io/caddy:2.5.1-alpine@sha256:6e62b63d4d7a4826f9e93c904a0e5b886a8bea2234b6569e300924282a2e8e6c
|
||||
|
||||
@@ -12,10 +12,6 @@ set -e
|
||||
VOLUME="$HOME/sourcegraph-docker/codeinsights-db-disk"
|
||||
./ensure-volume.sh $VOLUME 999
|
||||
|
||||
# Remove timescaledb from the shared_preload_libraries configuration
|
||||
# This step can be performed manually instead of run as part of the deploy script
|
||||
sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'timescaledb(.*)\'/\1 = '\2'/;s/,'/'/" $VOLUME/pgdata/postgresql.conf
|
||||
|
||||
docker run --detach \
|
||||
--name=codeinsights-db \
|
||||
--network=sourcegraph \
|
||||
|
||||
+8
-7
@@ -6,18 +6,18 @@ deploy_sourcegraph() {
|
||||
#Deploy sourcegraph
|
||||
if [[ "$TEST_TYPE" == "pure-docker-test" ]]; then
|
||||
./test/volume-config.sh
|
||||
./pure-docker/deploy.sh
|
||||
timeout 600s ./pure-docker/deploy.sh
|
||||
|
||||
if [[ "$GIT_BRANCH" == *"customer-replica"* ]]; then
|
||||
# Expected number of containers on e.g. 3.18-customer-replica branch.
|
||||
expect_containers="61"
|
||||
expect_containers="62"
|
||||
else
|
||||
# Expected number of containers on `master` branch.
|
||||
expect_containers="25"
|
||||
fi
|
||||
elif [[ "$TEST_TYPE" == "docker-compose-test" ]]; then
|
||||
docker-compose --file docker-compose/docker-compose.yaml up -d
|
||||
expect_containers="23"
|
||||
docker-compose --file docker-compose/docker-compose.yaml up -d -t 600
|
||||
expect_containers="26"
|
||||
fi
|
||||
|
||||
echo "Giving containers 30s to start..."
|
||||
@@ -41,6 +41,7 @@ test_containers() {
|
||||
containers=$(docker ps --format '{{.Names}}' | xargs -I{} -n1 sh -c "printf '{}: ' && docker inspect --format '{{.State.Status}}' {}")
|
||||
containers_running=$(echo "$containers" | grep -c "running")
|
||||
if [[ "$containers_running" -ne "$expect_containers" ]]; then
|
||||
containers_failing=$(docker ps --format '{{.Names}}:{{.Status}}' | grep -v Up | cut -f 1 -d :)
|
||||
echo "TEST FAILURE: expected $expect_containers containers running, found $containers_running. The following containers are failing: $containers_failing"
|
||||
exit 1
|
||||
fi
|
||||
@@ -56,10 +57,10 @@ test_containers() {
|
||||
}
|
||||
|
||||
catch_errors() {
|
||||
count=$(docker ps --format '{{.Names}}:{{.Status}}' | grep -c -v Up) || exit 0
|
||||
containers_failing=$(docker ps --format '{{.Names}}:{{.Status}}' | grep -v Up | cut -f 1 -d :)
|
||||
count=$(docker ps --format '{{.Names}}:{{.Status}}' | grep -c -v Up) || true
|
||||
if [[ $count -ne 0 ]]; then
|
||||
echo
|
||||
containers_failing=$(docker ps --format '{{.Names}}:{{.Status}}' | grep -v Up | cut -f 1 -d :)
|
||||
echo
|
||||
for cf in $containers_failing; do
|
||||
echo "$cf is failing. Review the log files uploaded as artefacts to see errors."
|
||||
docker logs -t "$cf" >"$cf".log 2>&1
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
# Create volume directories.
|
||||
cd /deploy-sourcegraph-docker
|
||||
echo
|
||||
echo "creating deployment for volume directories"
|
||||
echo
|
||||
./pure-docker/deploy.sh
|
||||
echo
|
||||
echo "tearing down deployment for volume directories"
|
||||
echo
|
||||
./pure-docker/teardown.sh
|
||||
# Set permissions on volume directories.
|
||||
#
|
||||
# IMPORTANT: If these change, or a new service is introduced, it must be explicitly called out in
|
||||
|
||||
Reference in new issue
Block a user