diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c5a938588..dda158491d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,17 +26,28 @@ jobs: integration-test: runs-on: ubuntu-20.04 name: "integration test" + strategy: + max-parallel: 1 + fail-fast: false + matrix: + include: + - compose_version: '1.28.0' + compose_path: '/usr/local/bin' + - compose_version: 'v2.0.1' + compose_path: '/usr/local/lib/docker/cli-plugins' steps: - name: Checkout uses: actions/checkout@v2 - - - name: Pin docker-compose + + - name: Get Compose run: | - COMPOSE_PATH=/usr/local/bin/docker-compose - source ./install/_min-requirements.sh - sudo rm $COMPOSE_PATH - sudo curl -L https://github.com/docker/compose/releases/download/${MIN_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` -o $COMPOSE_PATH - sudo chmod +x $COMPOSE_PATH + # Always remove `docker compose` support as that's the newer version + # and comes installed by default nowadays. + sudo rm -f "/usr/local/lib/docker/cli-plugins/docker-compose" + sudo rm -f "${{ matrix.compose_path }}/docker-compose" + sudo mkdir -p "${{ matrix.compose_path }}" + sudo curl -L https://github.com/docker/compose/releases/download/${{ matrix.compose_version }}/docker-compose-`uname -s`-`uname -m` -o "${{ matrix.compose_path }}/docker-compose" + sudo chmod +x "${{ matrix.compose_path }}/docker-compose" - name: Integration Test run: | diff --git a/_integration-test/run.sh b/_integration-test/run.sh index 6b66052bf5..ddb9973403 100755 --- a/_integration-test/run.sh +++ b/_integration-test/run.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -ex source "$(dirname $0)/../install/_lib.sh" @@ -118,7 +118,7 @@ done echo "${_endgroup}" echo "${_group}Ensure cleanup crons are working ..." -$dc ps | grep -q -- "-cleanup_.\+[[:space:]]\+Up[[:space:]]\+" +$dc ps | grep -q -E "\-cleanup\s+running\s+|\-cleanup_.+\s+Up\s+" echo "${_endgroup}" echo "${_group}Test custom CAs work ..." diff --git a/docker-compose.yml b/docker-compose.yml index 6314f8803d..29342e4abc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -93,7 +93,7 @@ services: smtp: <<: *restart_policy image: tianon/exim4 - hostname: ${SENTRY_MAIL_HOST:-} + hostname: ${SENTRY_MAIL_HOST:-''} volumes: - "sentry-smtp:/var/spool/exim4" - "sentry-smtp-log:/var/log/exim4" diff --git a/install/_lib.sh b/install/_lib.sh index 7b89461fa2..70f73c6e07 100644 --- a/install/_lib.sh +++ b/install/_lib.sh @@ -25,7 +25,8 @@ else _endgroup="" fi -dc="docker-compose --ansi never" +dc_base="$(docker compose version >/dev/null && echo 'docker compose' || echo 'docker-compose')" +dc="$dc_base --ansi never" dcr="$dc run --rm" # A couple of the config files are referenced from other subscripts, so they diff --git a/install/check-minimum-requirements.sh b/install/check-minimum-requirements.sh index 149b7d91da..fc564a2c52 100644 --- a/install/check-minimum-requirements.sh +++ b/install/check-minimum-requirements.sh @@ -3,8 +3,13 @@ echo "${_group}Checking minimum requirements ..." source "$(dirname $0)/_min-requirements.sh" DOCKER_VERSION=$(docker version --format '{{.Server.Version}}') -# Do NOT use $dc instead of `docker-compose` below as older versions don't support certain options and fail -COMPOSE_VERSION=$(docker-compose --version | sed 's/docker-compose version \(.\{1,\}\),.*/\1/') +# Get semantic version of Docker Compose v2 +if docker compose version >/dev/null; then + COMPOSE_VERSION=$(docker compose version --short | sed 's/v\{0,1\}\(.\{1,\}\)/\1/') +else + # Do NOT use $dc instead of `docker-compose` below as older versions don't support certain options and fail + COMPOSE_VERSION=$(docker-compose --version | sed 's/docker-compose version \(.\{1,\}\),.*/\1/') +fi RAM_AVAILABLE_IN_DOCKER=$(docker run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}'); CPU_AVAILABLE_IN_DOCKER=$(docker run --rm busybox nproc --all); diff --git a/install/wrap-up.sh b/install/wrap-up.sh index bbe08fac17..125e7e0133 100644 --- a/install/wrap-up.sh +++ b/install/wrap-up.sh @@ -18,7 +18,7 @@ else echo "" echo "You're all done! Run the following command to get Sentry running:" echo "" - echo " docker-compose up -d" + echo " $dc_base up -d" echo "" echo "-----------------------------------------------------------------" echo ""