From 138339a8a4ad8b2096eee306a60ce038956f1ee5 Mon Sep 17 00:00:00 2001 From: Guido Petri <18634426+guidopetri@users.noreply.github.com> Date: Sat, 7 Oct 2023 21:06:48 -0500 Subject: [PATCH] convert docker-compose to docker compose (#6504) --- .github/workflows/ci.yml | 16 ++++++++-------- Makefile | 22 +++++++++++----------- client/cypress/cypress.js | 10 +++++----- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1096b59d8..ab2cf792de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,15 +35,15 @@ jobs: - name: Build Docker Images run: | set -x - docker-compose build --build-arg install_groups="main,all_ds,dev" --build-arg skip_frontend_build=true - docker-compose up -d + docker compose build --build-arg install_groups="main,all_ds,dev" --build-arg skip_frontend_build=true + docker compose up -d sleep 10 - name: Create Test Database - run: docker-compose -p redash run --rm postgres psql -h postgres -U postgres -c "create database tests;" + run: docker compose -p redash run --rm postgres psql -h postgres -U postgres -c "create database tests;" - name: List Enabled Query Runners - run: docker-compose -p redash run --rm redash manage ds list_types + run: docker compose -p redash run --rm redash manage ds list_types - name: Run Tests - run: docker-compose -p redash run --name tests redash tests --junitxml=junit.xml --cov-report=xml --cov=redash --cov-config=.coveragerc tests/ + run: docker compose -p redash run --name tests redash tests --junitxml=junit.xml --cov-report=xml --cov=redash --cov-config=.coveragerc tests/ - name: Copy Test Results run: | mkdir -p /tmp/test-results/unit-tests @@ -137,12 +137,12 @@ jobs: set -x yarn cypress build yarn cypress start -- --skip-db-seed - docker-compose run cypress yarn cypress db-seed + docker compose run cypress yarn cypress db-seed - name: Execute Cypress Tests run: yarn cypress run-ci - name: "Failure: output container logs to console" if: failure() - run: docker-compose logs + run: docker compose logs - name: Copy Code Coverage Results run: docker cp cypress:/usr/src/app/coverage ./coverage || true - name: Store Coverage Results @@ -234,4 +234,4 @@ jobs: - name: "Failure: output container logs to console" if: failure() - run: docker-compose logs + run: docker compose logs diff --git a/Makefile b/Makefile index 731aa912e7..aa9d750efa 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,26 @@ .PHONY: compose_build up test_db create_database clean down tests lint backend-unit-tests frontend-unit-tests test build watch start redis-cli bash compose_build: .env - COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose build + COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose build up: - COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up -d --build + COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose up -d --build test_db: @for i in `seq 1 5`; do \ - if (docker-compose exec postgres sh -c 'psql -U postgres -c "select 1;"' 2>&1 > /dev/null) then break; \ + if (docker compose exec postgres sh -c 'psql -U postgres -c "select 1;"' 2>&1 > /dev/null) then break; \ else echo "postgres initializing..."; sleep 5; fi \ done - docker-compose exec postgres sh -c 'psql -U postgres -c "drop database if exists tests;" && psql -U postgres -c "create database tests;"' + docker compose exec postgres sh -c 'psql -U postgres -c "drop database if exists tests;" && psql -U postgres -c "create database tests;"' create_database: .env - docker-compose run server create_db + docker compose run server create_db clean: - docker-compose down && docker-compose rm + docker compose down && docker compose rm down: - docker-compose down + docker compose down .env: printf "REDASH_COOKIE_SECRET=`pwgen -1s 32`\nREDASH_SECRET_KEY=`pwgen -1s 32`\n" >> .env @@ -31,14 +31,14 @@ format: pre-commit run --all-files tests: - docker-compose run server tests + docker compose run server tests lint: ruff check . black --check . --diff backend-unit-tests: up test_db - docker-compose run --rm --name tests server tests + docker compose run --rm --name tests server tests frontend-unit-tests: CYPRESS_INSTALL_BINARY=0 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 yarn --frozen-lockfile @@ -56,7 +56,7 @@ start: yarn start redis-cli: - docker-compose run --rm redis redis-cli -h redis + docker compose run --rm redis redis-cli -h redis bash: - docker-compose run --rm server bash + docker compose run --rm server bash diff --git a/client/cypress/cypress.js b/client/cypress/cypress.js index c3957e3d62..8916a8f96e 100644 --- a/client/cypress/cypress.js +++ b/client/cypress/cypress.js @@ -44,18 +44,18 @@ function seedDatabase(seedValues) { function buildServer() { console.log("Building the server..."); - execSync("docker-compose -p cypress build", { stdio: "inherit" }); + execSync("docker compose -p cypress build", { stdio: "inherit" }); } function startServer() { console.log("Starting the server..."); - execSync("docker-compose -p cypress up -d", { stdio: "inherit" }); - execSync("docker-compose -p cypress run server create_db", { stdio: "inherit" }); + execSync("docker compose -p cypress up -d", { stdio: "inherit" }); + execSync("docker compose -p cypress run server create_db", { stdio: "inherit" }); } function stopServer() { console.log("Stopping the server..."); - execSync("docker-compose -p cypress down", { stdio: "inherit" }); + execSync("docker compose -p cypress down", { stdio: "inherit" }); } function runCypressCI() { @@ -81,7 +81,7 @@ function runCypressCI() { } execSync( - "COMMIT_INFO_MESSAGE=$(git show -s --format=%s) docker-compose run --name cypress cypress ./node_modules/.bin/percy exec -t 300 -- ./node_modules/.bin/cypress run $CYPRESS_OPTIONS", + "COMMIT_INFO_MESSAGE=$(git show -s --format=%s) docker compose run --name cypress cypress ./node_modules/.bin/percy exec -t 300 -- ./node_modules/.bin/cypress run $CYPRESS_OPTIONS", { stdio: "inherit" } ); }