work around docker-compose network race condition

Sometimes docker-compose up can try to create 2 networks with the same name at exactly the same time, causing an error. Fix this by assigning a unique project name to each container, so that it creates differently named networks.

Change-Id: Ie25793a316f815db03bd834b6f8e4dcaeac8f024
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/253588
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
Ryan Norton 2020-11-23 16:02:37 -07:00 committed by Aaron Ogata
parent e35ab372b1
commit 06c7dd9398
4 changed files with 4 additions and 3 deletions

View File

@ -10,5 +10,5 @@ if [[ "${COVERAGE:-}" == "1" ]]; then
sentry="-e SENTRY_URL -e SENTRY_DSN -e SENTRY_ORG -e SENTRY_PROJECT -e SENTRY_AUTH_TOKEN -e DEPRECATION_SENTRY_DSN"
fi
docker-compose run --name $CONTAINER_NAME -e COVERAGE -e FORCE_FAILURE -e RAILS_ENV=test $sentry canvas \
docker-compose --project-name $CONTAINER_NAME run -e COVERAGE -e FORCE_FAILURE -e RAILS_ENV=test $sentry canvas \
bash -c "bundle exec rails graphql:schema && yarn test:jest$EXTRA"

View File

@ -8,4 +8,4 @@ if [[ "${COVERAGE:-}" == "1" ]]; then
sentry="-e SENTRY_URL -e SENTRY_DSN -e SENTRY_ORG -e SENTRY_PROJECT -e SENTRY_AUTH_TOKEN -e DEPRECATION_SENTRY_DSN"
fi
docker-compose run --name $CONTAINER_NAME -e CI_NODE_INDEX -e CI_NODE_TOTAL -e COVERAGE -e FORCE_FAILURE $sentry canvas yarn test:karma:headless
docker-compose --project-name $CONTAINER_NAME run -e CI_NODE_INDEX -e CI_NODE_TOTAL -e COVERAGE -e FORCE_FAILURE $sentry canvas yarn test:karma:headless

View File

@ -8,4 +8,4 @@ if [[ "${COVERAGE:-}" == "1" ]]; then
sentry="-e SENTRY_URL -e SENTRY_DSN -e SENTRY_ORG -e SENTRY_PROJECT -e SENTRY_AUTH_TOKEN -e DEPRECATION_SENTRY_DSN"
fi
docker-compose run --name $CONTAINER_NAME -e COVERAGE -e FORCE_FAILURE $sentry canvas yarn test:packages
docker-compose --project-name $CONTAINER_NAME run -e COVERAGE -e FORCE_FAILURE $sentry canvas yarn test:packages

View File

@ -3,6 +3,7 @@ services:
canvas:
environment:
- JSPEC_GROUP
image: local/js-runner
build:
context: .
dockerfile: ./build/new-jenkins/js/Dockerfile