I’m trying to build an app image in job 1 and run 2 sets of tests in parallel jobs 2 and 3 with following config:
version: 2.1
jobs:
build_candidate_artifacts:
docker:
- image: cimg/node:16.19.0
resource_class: medium+
steps:
- setup_remote_docker:
version: 20.10.18
docker_layer_caching: true
- checkout
- run:
name: Build test env Docker image
command: docker compose -f ./docker/docker-compose.test.yml build --progress plain
run_e2e_tests:
docker:
- image: cimg/base:2023.01
resource_class: small
steps:
- setup_remote_docker:
version: 20.10.18
docker_layer_caching: true
- checkout
- run:
name: Launch app network
command: docker compose -f docker/docker-compose.test.yml up -d --wait
- run:
name: Build E2E runner
command: docker build -f Dockerfile.e2e -t e2e-runner .
working_directory: e2e
- run:
name: Run E2E tests
command: docker run --network app-test --name e2e-container -it e2e-runner yarn ci
working_directory: e2e
# ...
# - run_backend_tests with similar command
workflows:
run-all-tests:
jobs:
- build_candidate_artifacts:
- run_e2e_tests:
requires:
- build_candidate_artifacts
- run_backend_tests:
requires:
- build_candidate_artifacts
It works well on some of the days, on other I have to re-run the workflow up to 5 times for the test job to run properly. The issues faced include:
-
run_e2e_tests
job rebuilds Docker images from scratch which fails, because there are required dependencies inbuild
job - only one of
run_e2e_tests
andrun_backend_tests
jobs picks up the built image, second one starts building from scratch. order has been random - the
app-test
network reports as up and healthy, buttest-app
container does not respond to http requests
I had hoped that DLC will allow to speed up the pipeline. Though, I could not find in the docs whether such setup is guaranteed to work.
Please advise what is the correct way to build a candidate Docker image, run tests on it and in case of success promote it to staging/production. Currently it fails unexpectedly that does not allow me to use it for main branch process.