Only try running redis container for integration tests where it's
needed.
@@ -141,18 +141,20 @@ jobs:
# Used for the coordination backend for integration tests
# TODO: Only start this for integration tests via job step
# https://github.community/t/conditional-services-in-a-job/135301/3
- redis:
- # Docker Hub image
- image: redis
- # Set health checks to wait until redis has started
- options: >-
- --name "redis"
- --health-cmd "redis-cli ping"
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
- ports:
- - 6379:6379/tcp
+ # NOTE: To speed things up, we only start redis for integration tests
+ # where it's needed
+ # redis:
+ # # Docker Hub image
+ # image: redis
+ # # Set health checks to wait until redis has started
+ # options: >-
+ # --name "redis"
+ # --health-cmd "redis-cli ping"
+ # --health-interval 10s
+ # --health-timeout 5s
+ # --health-retries 5
+ # ports:
+ # - 6379:6379/tcp
env:
TASK: '${{ matrix.task }}'
@@ -273,6 +275,12 @@ jobs:
cp conf/st2.dev.conf "${ST2_CONF}" ; sed -i -e "s/stanley/${ST2_CI_USER}/" "${ST2_CONF}"
./scripts/ci/add-itest-user-key.sh
sudo .circle/add-itest-user.sh
+ - name: Run Redis Service Container
+ if: "${{ env.TASK == 'ci-integration' }}"
+ timeout-minutes: 2
+ run: |
+ docker run --rm --detach -p 127.0.0.1:6379:6379/tcp --name redis redis:latest
+ until [ "$(docker inspect -f {{.State.Running}} redis)" == "true" ]; do sleep 0.1; done
- name: Permissions Workaround
if: "${{ env.TASK == 'ci-packs-tests' || env.TASK == 'ci-integration' }}"
run: |
@@ -310,6 +318,9 @@ jobs:
if: "${{ success() && ((env.TASK == 'ci-unit') || (env.TASK == 'ci-integration')) && (env.ENABLE_COVERAGE == 'yes') }}"
run: |
./scripts/ci/submit-codecov-coverage.sh
+ - name: Stop Redis Service Container
+ if: "${{ always() && env.TASK == 'ci-integration' }}"
+ run: docker stop redis || true
slack-notification:
name: Slack notification for failed master builds
if: always()
