From e0781e73b96d8807363c20b2a100d67c7ccd4986 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Sat, 1 Jun 2024 11:27:37 -0700 Subject: [PATCH] Allow custom options on container test run (#288) --- .github/actions/docker/action.yml | 6 +++++- .github/workflows/ci-build.yml | 7 ++++++- .github/workflows/ci.yml | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/actions/docker/action.yml b/.github/actions/docker/action.yml index 97aa3ace..85eccc72 100644 --- a/.github/actions/docker/action.yml +++ b/.github/actions/docker/action.yml @@ -47,6 +47,10 @@ inputs: default: 'true' description: 'Whenever the container should be tested on pr.' required: false + CONTAINER_TEST_RUN_OPTIONS: + default: '' + description: 'Custom options for the docker run command that executes the test' + required: false CONTAINER_TEST_COMMAND: default: '' description: 'A custom command to test the docker container.' @@ -145,7 +149,7 @@ runs: run: | docker images echo "Starting container for image: ${{ steps.meta.outputs.tags }}" - docker run -d --rm --name test ${{ fromJSON(steps.meta.outputs.json).tags[0] }} + docker run -d --rm --name test ${{ inputs.CONTAINER_TEST_RUN_OPTIONS }} ${{ fromJSON(steps.meta.outputs.json).tags[0] }} sleep 20 docker ps docker logs test diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 083445bf..27fcfb15 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -77,6 +77,10 @@ on: type: boolean default: true description: 'Whenever the container should be tested on pr.' + CONTAINER_TEST_RUN_OPTIONS: + type: string + default: '' + description: 'Custom options for the docker run command that executes the test' CONTAINER_TEST_COMMAND: type: string default: '' @@ -225,7 +229,7 @@ jobs: uses: actions/checkout@v4 with: repository: signalwire/actions-template - ref: main + ref: main path: actions - uses: ./actions/.github/actions/gpg @@ -273,6 +277,7 @@ jobs: IMAGE_REPO: ${{ inputs.IMAGE_REPO }} BUILD_ARGS: ${{ inputs.BUILD_ARGS }} CONTAINER_TEST: ${{ inputs.CONTAINER_TEST }} + CONTAINER_TEST_RUN_OPTIONS: ${{ inputs.CONTAINER_TEST_RUN_OPTIONS }} CONTAINER_TEST_COMMAND: ${{ inputs.CONTAINER_TEST_COMMAND }} OUTPUT_TAG_INDEX: ${{ inputs.OUTPUT_TAG_INDEX }} CACHE_FROM: ${{ inputs.CACHE_FROM }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f39c89d..eec76798 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,6 +91,10 @@ on: type: boolean default: true description: 'Whenever the container should be tested on pr.' + CONTAINER_TEST_RUN_OPTIONS: + type: string + default: '' + description: 'Custom options for the docker run command that executes the test' CONTAINER_TEST_COMMAND: type: string default: '' @@ -255,6 +259,7 @@ jobs: PLATFORMS: ${{ inputs.PLATFORMS }} CONTAINER_SCAN: ${{ inputs.CONTAINER_SCAN }} CONTAINER_TEST: ${{ inputs.CONTAINER_TEST }} + CONTAINER_TEST_RUN_OPTIONS: ${{ inputs.CONTAINER_TEST_RUN_OPTIONS }} CONTAINER_TEST_COMMAND: ${{ inputs.CONTAINER_TEST_COMMAND }} RUNNER: ${{ inputs.RUNNER }} TAG: ${{ inputs.TAG }}