From aad7ac02dab5f695fcba840dc58cff491c2e3b3c Mon Sep 17 00:00:00 2001 From: Ben McClelland Date: Wed, 25 Sep 2024 13:44:59 -0700 Subject: [PATCH] fix: docker build/invocation for test runners --- .github/workflows/docker-bats.yml | 24 ++++++++++++------------ tests/Dockerfile_direct | 2 +- tests/docker-compose-bats.yml | 6 ------ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/docker-bats.yml b/.github/workflows/docker-bats.yml index d980e5b..526510a 100644 --- a/.github/workflows/docker-bats.yml +++ b/.github/workflows/docker-bats.yml @@ -10,19 +10,19 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build Docker Image run: | - mv tests/.env.docker.default tests/.env.docker - mv tests/.secrets.default tests/.secrets - docker build --build-arg="GO_LIBRARY=go1.23.1.linux-amd64.tar.gz" \ - --build-arg="AWS_CLI=awscli-exe-linux-x86_64.zip" --build-arg="MC_FOLDER=linux-amd64" \ - --progress=plain -f tests/Dockerfile_test_bats -t bats_test . - - - name: Set up Docker Compose - run: sudo apt-get install -y docker-compose + cp tests/.env.docker.default tests/.env.docker + cp tests/.secrets.default tests/.secrets + docker build \ + --build-arg="GO_LIBRARY=go1.23.1.linux-amd64.tar.gz" \ + --build-arg="AWS_CLI=awscli-exe-linux-x86_64.zip" \ + --build-arg="MC_FOLDER=linux-amd64" \ + --progress=plain \ + -f tests/Dockerfile_test_bats \ + -t bats_test . - name: Run Docker Container - run: docker-compose -f tests/docker-compose-bats.yml up --exit-code-from s3api_np_only s3api_np_only + run: | + docker compose -f tests/docker-compose-bats.yml --project-directory . \ + up --exit-code-from s3api_np_only s3api_np_only diff --git a/tests/Dockerfile_direct b/tests/Dockerfile_direct index 25af863..5e4ecc1 100644 --- a/tests/Dockerfile_direct +++ b/tests/Dockerfile_direct @@ -47,7 +47,7 @@ RUN git clone https://github.com/bats-core/bats-core.git && \ USER tester RUN mkdir -p /home/tester/tests -COPY --chown=tester:tester . /home/tester/tests +COPY --chown=tester:tester . /home/tester # add bats support libraries RUN git clone https://github.com/bats-core/bats-support.git && rm -rf /home/tester/tests/bats-support && mv bats-support /home/tester/tests diff --git a/tests/docker-compose-bats.yml b/tests/docker-compose-bats.yml index 4093d79..f63a0ce 100644 --- a/tests/docker-compose-bats.yml +++ b/tests/docker-compose-bats.yml @@ -1,33 +1,28 @@ services: no_certs: build: - context: ../ dockerfile: tests/Dockerfile_test_bats args: - CONFIG_FILE=tests/.env.nocerts static_buckets: build: - context: ../ dockerfile: tests/Dockerfile_test_bats args: - CONFIG_FILE=tests/.env.static posix_backend: build: - context: ../ dockerfile: tests/Dockerfile_test_bats args: - CONFIG_FILE=tests/.env.default image: bats_test s3_backend: build: - context: ../ dockerfile: tests/Dockerfile_test_bats args: - CONFIG_FILE=tests/.env.s3 - SECRETS_FILE=tests/.secrets.s3 s3api_np_only: build: - context: ../ dockerfile: tests/Dockerfile_test_bats args: - CONFIG_FILE=tests/.env.default @@ -35,7 +30,6 @@ services: command: ["s3api-non-policy"] direct: build: - context: ../ dockerfile: tests/Dockerfile_direct volumes: - ./.env.direct:/home/tester/tests/.env.direct