From f6af9f9c6d9636182ebc0fcd2c7afec43347bc97 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Mon, 1 Apr 2024 22:56:34 +0200 Subject: [PATCH] Move cleanup-docker to a shell scripts from composite action Cleaning up docker is a single bash script to execute - it is defined as a composite action but since it's just one bash commenad to execute, it is better to just keep it as a bash script instead - which wil make it easier to add other scripts. --- .../workflows/additional-ci-image-checks.yml | 4 ++-- .../workflows/additional-prod-image-tests.yml | 8 +++---- .github/workflows/basic-tests.yml | 24 +++++++++---------- .github/workflows/build-images.yml | 4 ++-- .github/workflows/check-providers.yml | 12 +++++----- .github/workflows/ci-image-build.yml | 4 ++-- .github/workflows/ci.yml | 12 +++++----- .github/workflows/finalize-tests.yml | 8 +++---- .github/workflows/generate-constraints.yml | 4 ++-- .github/workflows/helm-tests.yml | 8 +++---- .github/workflows/integration-tests.yml | 4 ++-- .github/workflows/k8s-tests.yml | 4 ++-- .github/workflows/prod-image-build.yml | 8 +++---- .github/workflows/push-image-cache.yml | 8 +++---- .github/workflows/release_dockerhub_image.yml | 8 +++---- .github/workflows/run-unit-tests.yml | 4 ++-- .github/workflows/static-checks-mypy-docs.yml | 12 +++++----- .../ci/cleanup_docker.sh | 16 +++++-------- 18 files changed, 74 insertions(+), 78 deletions(-) rename .github/actions/cleanup-docker/action.yml => scripts/ci/cleanup_docker.sh (79%) mode change 100644 => 100755 diff --git a/.github/workflows/additional-ci-image-checks.yml b/.github/workflows/additional-ci-image-checks.yml index 25ecd5f9524ac..7d0eb88d24130 100644 --- a/.github/workflows/additional-ci-image-checks.yml +++ b/.github/workflows/additional-ci-image-checks.yml @@ -136,8 +136,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: "Login to ghcr.io" diff --git a/.github/workflows/additional-prod-image-tests.yml b/.github/workflows/additional-prod-image-tests.yml index 500a4371a675e..9d963193111b1 100644 --- a/.github/workflows/additional-prod-image-tests.yml +++ b/.github/workflows/additional-prod-image-tests.yml @@ -107,8 +107,8 @@ jobs: with: fetch-depth: 2 persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: Login to ghcr.io @@ -153,8 +153,8 @@ jobs: with: fetch-depth: 2 persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: Login to ghcr.io diff --git a/.github/workflows/basic-tests.yml b/.github/workflows/basic-tests.yml index eea256b6a22dd..db84bae38e2e2 100644 --- a/.github/workflows/basic-tests.yml +++ b/.github/workflows/basic-tests.yml @@ -66,8 +66,8 @@ jobs: # Need to fetch all history for selective checks tests fetch-depth: 0 persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - uses: actions/setup-python@v5 with: python-version: "${{ inputs.default-python-version }}" @@ -90,8 +90,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Setup node" uses: actions/setup-node@v4 with: @@ -120,8 +120,8 @@ jobs: with: fetch-depth: 2 persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -209,8 +209,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Setup python" uses: actions/setup-python@v5 with: @@ -278,8 +278,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh # Install python from scratch. No cache used. We always want to have fresh version of everything - uses: actions/setup-python@v5 with: @@ -350,8 +350,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: "Cleanup dist files" diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index e9104effee0b8..d19e9572c7f55 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -133,8 +133,8 @@ jobs: # COMPOSITE ACTIONS. WE CAN RUN ANYTHING THAT IS IN THE TARGET BRANCH AND THERE IS NO RISK THAT # CODE WILL BE RUN FROM THE PR. #################################################################################################### - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Setup python" uses: actions/setup-python@v5 with: diff --git a/.github/workflows/check-providers.yml b/.github/workflows/check-providers.yml index 839b310046261..d71b8d678dff0 100644 --- a/.github/workflows/check-providers.yml +++ b/.github/workflows/check-providers.yml @@ -75,8 +75,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: > Prepare breeze & CI image: ${{ inputs.default-python-version }}:${{ inputs.image-tag }} uses: ./.github/actions/prepare_breeze_and_image @@ -140,8 +140,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: > Prepare breeze & CI image: ${{ inputs.default-python-version }}:${{ inputs.image-tag }} uses: ./.github/actions/prepare_breeze_and_image @@ -214,8 +214,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Prepare breeze & CI image: ${{ matrix.python-version }}:${{ inputs.image-tag }}" uses: ./.github/actions/prepare_breeze_and_image - name: "Cleanup dist files" diff --git a/.github/workflows/ci-image-build.yml b/.github/workflows/ci-image-build.yml index 5864eea6a9baf..cd11376a82119 100644 --- a/.github/workflows/ci-image-build.yml +++ b/.github/workflows/ci-image-build.yml @@ -182,8 +182,8 @@ ${{ inputs.do-build == 'true' && inputs.image-tag || '' }}" # BE RUN SAFELY AS PART OF DOCKER BUILD. BECAUSE IT RUNS INSIDE THE DOCKER CONTAINER AND IT IS # ISOLATED FROM THE RUNNER. #################################################################################################### - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh if: inputs.do-build == 'true' - name: "Install Breeze" uses: ./.github/actions/breeze diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fd4a3b5cdaf7..39fbbd7811ee7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,8 +128,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: Fetch incoming commit ${{ github.sha }} with its parent uses: actions/checkout@v4 with: @@ -216,8 +216,8 @@ jobs: with: persist-credentials: false if: needs.build-info.outputs.in-workflow-build == 'false' - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh if: needs.build-info.outputs.in-workflow-build == 'false' - name: "Install Breeze" uses: ./.github/actions/breeze @@ -534,8 +534,8 @@ jobs: with: persist-credentials: false if: needs.build-info.outputs.in-workflow-build == 'false' - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh if: needs.build-info.outputs.in-workflow-build == 'false' - name: "Install Breeze" uses: ./.github/actions/breeze diff --git a/.github/workflows/finalize-tests.yml b/.github/workflows/finalize-tests.yml index 8b61225400ada..5a3398d6a08fd 100644 --- a/.github/workflows/finalize-tests.yml +++ b/.github/workflows/finalize-tests.yml @@ -98,8 +98,8 @@ jobs: with: # Needed to perform push action persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Set constraints branch name" id: constraints-branch run: ./scripts/ci/constraints/ci_branch_constraints.sh >> ${GITHUB_OUTPUT} @@ -185,8 +185,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Download all artifacts from the current build" uses: actions/download-artifact@v4 with: diff --git a/.github/workflows/generate-constraints.yml b/.github/workflows/generate-constraints.yml index 57621102f857b..207fd4339c8db 100644 --- a/.github/workflows/generate-constraints.yml +++ b/.github/workflows/generate-constraints.yml @@ -69,8 +69,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: Login to ghcr.io diff --git a/.github/workflows/helm-tests.yml b/.github/workflows/helm-tests.yml index 0c18472648ff6..8b26769ff4bc7 100644 --- a/.github/workflows/helm-tests.yml +++ b/.github/workflows/helm-tests.yml @@ -70,8 +70,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Prepare breeze & CI image: ${{inputs.default-python-version}}:${{inputs.image-tag}}" uses: ./.github/actions/prepare_breeze_and_image - name: "Helm Unit Tests: ${{ matrix.helm-test-package }}" @@ -91,8 +91,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: Setup git for tagging diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 054b745cb766d..57aa4efa466ea 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -97,8 +97,8 @@ jobs: with: persist-credentials: false if: inputs.is-airflow-runner == 'true' || matrix.backend == 'postgres' - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh if: inputs.is-airflow-runner == 'true' || matrix.backend == 'postgres' - name: "Prepare breeze & CI image: ${{ inputs.default-python-version }}:${{ inputs.image-tag }}" uses: ./.github/actions/prepare_breeze_and_image diff --git a/.github/workflows/k8s-tests.yml b/.github/workflows/k8s-tests.yml index 74a40db287626..ad0f3ece46729 100644 --- a/.github/workflows/k8s-tests.yml +++ b/.github/workflows/k8s-tests.yml @@ -76,8 +76,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze id: breeze diff --git a/.github/workflows/prod-image-build.yml b/.github/workflows/prod-image-build.yml index 37ef43259a497..5643724a8b359 100644 --- a/.github/workflows/prod-image-build.yml +++ b/.github/workflows/prod-image-build.yml @@ -132,8 +132,8 @@ jobs: with: persist-credentials: false if: inputs.do-build == 'true' && inputs.upload-package-artifact == 'true' - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh if: inputs.do-build == 'true' && inputs.upload-package-artifact == 'true' - uses: actions/setup-python@v5 with: @@ -268,8 +268,8 @@ ${{ inputs.do-build == 'true' && inputs.image-tag || '' }}" # BE RUN SAFELY AS PART OF DOCKER BUILD. BECAUSE IT RUNS INSIDE THE DOCKER CONTAINER AND IT IS # ISOLATED FROM THE RUNNER. #################################################################################################### - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh if: inputs.do-build == 'true' - name: "Install Breeze" uses: ./.github/actions/breeze diff --git a/.github/workflows/push-image-cache.yml b/.github/workflows/push-image-cache.yml index 83152426eabec..becd7165aa327 100644 --- a/.github/workflows/push-image-cache.yml +++ b/.github/workflows/push-image-cache.yml @@ -117,8 +117,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: "Start ARM instance" @@ -179,8 +179,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: "Cleanup dist and context file" diff --git a/.github/workflows/release_dockerhub_image.yml b/.github/workflows/release_dockerhub_image.yml index d489feae94439..d45aa2c4be1e2 100644 --- a/.github/workflows/release_dockerhub_image.yml +++ b/.github/workflows/release_dockerhub_image.yml @@ -59,8 +59,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: Selective checks @@ -94,8 +94,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Install Breeze" uses: ./.github/actions/breeze - name: Free space diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 65ff0694880d5..c1338837525aa 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -149,8 +149,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Prepare breeze & CI image: ${{matrix.python-version}}:${{ inputs.image-tag }}" uses: ./.github/actions/prepare_breeze_and_image - name: > diff --git a/.github/workflows/static-checks-mypy-docs.yml b/.github/workflows/static-checks-mypy-docs.yml index bde5dd1b611e9..f517eb6a97815 100644 --- a/.github/workflows/static-checks-mypy-docs.yml +++ b/.github/workflows/static-checks-mypy-docs.yml @@ -113,8 +113,8 @@ jobs: python-version: ${{ inputs.default-python-version }} cache: 'pip' cache-dependency-path: ./dev/breeze/pyproject.toml - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Prepare breeze & CI image: ${{ inputs.default-python-version}}:${{ inputs.image-tag }}" uses: ./.github/actions/prepare_breeze_and_image id: breeze @@ -157,8 +157,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Prepare breeze & CI image: ${{ inputs.default-python-version }}:${{ inputs.image-tag }}" uses: ./.github/actions/prepare_breeze_and_image id: breeze @@ -199,8 +199,8 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Cleanup docker - uses: ./.github/actions/cleanup-docker + - name: "Cleanup docker" + run: ./scripts/ci/cleanup_docker.sh - name: "Prepare breeze & CI image: ${{ inputs.default-python-version }}:${{ inputs.image-tag }}" uses: ./.github/actions/prepare_breeze_and_image - uses: actions/cache@v4 diff --git a/.github/actions/cleanup-docker/action.yml b/scripts/ci/cleanup_docker.sh old mode 100644 new mode 100755 similarity index 79% rename from .github/actions/cleanup-docker/action.yml rename to scripts/ci/cleanup_docker.sh index fa64e5b264dec..039b462279fc1 --- a/.github/actions/cleanup-docker/action.yml +++ b/scripts/ci/cleanup_docker.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -14,13 +15,8 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# ---- -name: 'Cleanup docker' -description: 'Cleans up docker' -runs: - using: "composite" - steps: - - name: "Cleanup docker" - shell: bash - run: docker system prune --all --force --volumes +function cleanup_docker { + docker system prune --all --force --volumes +} + +cleanup_docker