This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch better-cleanup-for-ci in repository https://gitbox.apache.org/repos/asf/airflow.git
commit a84dd8f525ba02ed5649b411739a85ec94e938af Author: Jarek Potiuk <ja...@potiuk.com> AuthorDate: Thu Mar 14 15:35:08 2024 +0100 Better and more complete cleanup for CI jobs Some of the recent refactors caused a problem that mypy jobs started to return errors likely resulting from a bad cache volume remaining after the jobs completed. This PR extracts cleanup step to a separate, composite action and uses this action everywhere, including pruning docker including all containers and volumes to avoid the issue. --- .github/actions/cleanup/action.yml | 29 +++++ .github/workflows/build-images.yml | 12 +- .github/workflows/ci-image-build.yml | 4 +- .github/workflows/ci.yml | 153 ++++++++++++-------------- .github/workflows/helm-tests.yml | 8 +- .github/workflows/mypy.yml | 4 +- .github/workflows/prod-image-build.yml | 4 +- .github/workflows/push-image-cache.yml | 6 +- .github/workflows/release_dockerhub_image.yml | 8 +- 9 files changed, 121 insertions(+), 107 deletions(-) diff --git a/.github/actions/cleanup/action.yml b/.github/actions/cleanup/action.yml new file mode 100644 index 0000000000..87aa99b663 --- /dev/null +++ b/.github/actions/cleanup/action.yml @@ -0,0 +1,29 @@ +# 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 +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +name: 'Cleanup docker and repo' +description: 'Cleans up docker and repository' +runs: + using: "composite" + steps: + - name: "Cleanup docker" + shell: bash + run: docker system prune --all --force --volumes + - name: "Cleanup repo" + shell: bash + run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index c1619874a9..e290711b33 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -113,8 +113,8 @@ jobs: } }' --jq '.data.node.labels.nodes[]' | jq --slurp -c '[.[].name]' >> ${GITHUB_OUTPUT} if: github.event_name == 'pull_request_target' - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - uses: actions/checkout@v4 with: ref: ${{ env.TARGET_COMMIT_SHA }} @@ -183,8 +183,8 @@ jobs: VERSION_SUFFIX_FOR_PYPI: "dev0" USE_UV: "true" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - uses: actions/checkout@v4 with: ref: ${{ needs.build-info.outputs.target-commit-sha }} @@ -262,8 +262,8 @@ jobs: INCLUDE_NOT_READY_PROVIDERS: "true" USE_UV: "true" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - uses: actions/checkout@v4 with: ref: ${{ needs.build-info.outputs.target-commit-sha }} diff --git a/.github/workflows/ci-image-build.yml b/.github/workflows/ci-image-build.yml index c0ae69a4b8..8a2d81f13e 100644 --- a/.github/workflows/ci-image-build.yml +++ b/.github/workflows/ci-image-build.yml @@ -102,8 +102,8 @@ ${{ inputs.do-build == 'true' && inputs.image-tag || '' }}" DEFAULT_CONSTRAINTS_BRANCH: ${{ inputs.constraints-branch }} VERSION_SUFFIX_FOR_PYPI: "dev0" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup if: inputs.do-build == 'true' - uses: actions/checkout@v4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81368e6d5a..8faacf810d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,8 +139,8 @@ jobs: canary-run: ${{ steps.source-run-info.outputs.canary-run }} run-coverage: ${{ steps.source-run-info.outputs.run-coverage }} steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -219,8 +219,8 @@ jobs: needs.build-info.outputs.canary-run == 'true' && needs.build-info.outputs.default-branch == 'main' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -262,8 +262,8 @@ jobs: runs-on: ${{fromJSON(needs.build-info.outputs.runs-on)}} needs: [build-info] steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - uses: actions/checkout@v4 with: # Need to fetch all history for selective checks tests @@ -285,8 +285,8 @@ jobs: needs: [build-info] if: needs.build-info.outputs.run-www-tests == 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -313,8 +313,8 @@ jobs: needs: [build-info] if: needs.build-info.outputs.needs-api-codegen == 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -407,8 +407,8 @@ jobs: # Force more parallelism for pull even on public images PARALLELISM: 6 steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup if: needs.build-info.outputs.in-workflow-build == 'false' - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 @@ -442,8 +442,8 @@ jobs: VERSION_SUFFIX_FOR_PYPI: "dev0" if: needs.build-info.outputs.ci-image-build == 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -515,8 +515,8 @@ jobs: needs.build-info.outputs.basic-checks-only == 'false' && needs.build-info.outputs.latest-versions-only != 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -555,8 +555,8 @@ jobs: needs.build-info.outputs.canary-run == 'true' && needs.build-info.outputs.latest-versions-only != 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -641,8 +641,8 @@ jobs: RUNS_ON: "${{needs.build-info.outputs.runs-on}}" if: needs.build-info.outputs.basic-checks-only == 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -694,8 +694,8 @@ jobs: RUNS_ON: "${{needs.build-info.outputs.runs-on}}" PYTHON_MAJOR_MINOR_VERSION: "${{needs.build-info.outputs.default-python-version}}" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -760,8 +760,8 @@ jobs: RUNS_ON: "${{needs.build-info.outputs.runs-on}}" PYTHON_MAJOR_MINOR_VERSION: "${{needs.build-info.outputs.default-python-version}}" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -793,8 +793,8 @@ jobs: needs.build-info.outputs.skip-provider-tests != 'true' && needs.build-info.outputs.latest-versions-only != 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -856,8 +856,8 @@ jobs: needs.build-info.outputs.canary-run == 'true' && needs.build-info.outputs.skip-provider-tests != 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -926,8 +926,8 @@ jobs: VERSION_SUFFIX_FOR_PYPI: "dev0" if: needs.build-info.outputs.skip-provider-tests != 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup if: contains(fromJson(needs.build-info.outputs.python-versions),matrix.python-version) - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 @@ -978,8 +978,8 @@ jobs: RUNS_ON: "${{needs.build-info.outputs.runs-on}}" PYTHON_MAJOR_MINOR_VERSION: "${{needs.build-info.outputs.default-python-version}}" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1046,9 +1046,8 @@ jobs: ENABLE_COVERAGE: "${{needs.build-info.outputs.run-coverage}}" if: needs.build-info.outputs.run-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1102,9 +1101,8 @@ jobs: ${{needs.build-info.outputs.default-postgres-version}} if: needs.build-info.outputs.run-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1151,9 +1149,8 @@ jobs: ${{needs.build-info.outputs.default-postgres-version}} if: needs.build-info.outputs.run-tests == 'true' && needs.build-info.outputs.run-amazon-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1203,9 +1200,8 @@ jobs: ${{needs.build-info.outputs.default-postgres-version}} if: needs.build-info.outputs.run-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1254,9 +1250,8 @@ jobs: needs.build-info.outputs.run-tests == 'true' && needs.build-info.outputs.latest-versions-only != 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1303,9 +1298,8 @@ jobs: ${{needs.build-info.outputs.default-postgres-version}} if: needs.build-info.outputs.run-tests == 'true' && needs.build-info.outputs.run-amazon-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1354,9 +1348,8 @@ jobs: JOB_ID: "mysql-${{matrix.mysql-version}}-${{matrix.python-version}}" if: needs.build-info.outputs.run-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1406,9 +1399,8 @@ jobs: BACKEND_VERSION: "" JOB_ID: "sqlite-${{matrix.python-version}}" steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1453,9 +1445,8 @@ jobs: SKIP_PROVIDER_TESTS: "${{needs.build-info.outputs.skip-provider-tests}}" if: needs.build-info.outputs.run-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1528,9 +1519,8 @@ jobs: SKIP_PROVIDER_TESTS: "${{needs.build-info.outputs.skip-provider-tests}}" if: needs.build-info.outputs.run-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup if: needs.build-info.outputs.is-airflow-runner == 'true' - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 @@ -1569,9 +1559,8 @@ jobs: ENABLE_COVERAGE: "${{needs.build-info.outputs.run-coverage}}" if: needs.build-info.outputs.run-tests == 'true' && needs.build-info.outputs.is-airflow-runner == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1627,9 +1616,8 @@ jobs: ENABLE_COVERAGE: "${{needs.build-info.outputs.run-coverage}}" if: needs.build-info.outputs.run-tests == 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1667,9 +1655,8 @@ jobs: needs.build-info.outputs.run-tests == 'true' && needs.build-info.outputs.latest-versions-only != 'true' steps: - - name: Cleanup repo - shell: bash - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1704,8 +1691,8 @@ jobs: env: RUNS_ON: "${{needs.build-info.outputs.runs-on}}" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1797,8 +1784,8 @@ jobs: # Force more parallelism for pull on public images PARALLELISM: 6 steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup if: needs.build-info.outputs.in-workflow-build == 'false' - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 @@ -1826,8 +1813,8 @@ jobs: needs: [build-info, wait-for-prod-images] if: needs.build-info.outputs.prod-image-build == 'true' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1867,8 +1854,8 @@ jobs: env: PYTHON_MAJOR_MINOR_VERSION: "${{needs.build-info.outputs.default-python-version}}" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1909,8 +1896,8 @@ jobs: ( needs.build-info.outputs.run-kubernetes-tests == 'true' || needs.build-info.outputs.needs-helm-tests == 'true') steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -1986,8 +1973,8 @@ jobs: PYTHON_VERSIONS: ${{ needs.build-info.outputs.python-versions-list-as-string }} if: needs.build-info.outputs.upgrade-to-newer-dependencies != 'false' steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: diff --git a/.github/workflows/helm-tests.yml b/.github/workflows/helm-tests.yml index efa6ed8932..a1c5ce733f 100644 --- a/.github/workflows/helm-tests.yml +++ b/.github/workflows/helm-tests.yml @@ -63,8 +63,8 @@ jobs: IMAGE_TAG: "${{ inputs.image-tag }}" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -84,8 +84,8 @@ jobs: RUNS_ON: "${{inputs.runs-on}}" PYTHON_MAJOR_MINOR_VERSION: "${{inputs.default-python-version}}" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 4e5f98a03d..cf732f7dfb 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -61,8 +61,8 @@ jobs: IMAGE_TAG: "${{ inputs.image-tag }}" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup if: inputs.needs-mypy == 'true' - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 diff --git a/.github/workflows/prod-image-build.yml b/.github/workflows/prod-image-build.yml index b6f17b1f70..1a0b40f4de 100644 --- a/.github/workflows/prod-image-build.yml +++ b/.github/workflows/prod-image-build.yml @@ -106,8 +106,8 @@ ${{ inputs.do-build == 'true' && inputs.image-tag || '' }}" DEFAULT_CONSTRAINTS_BRANCH: ${{ inputs.constraints-branch }} VERSION_SUFFIX_FOR_PYPI: "dev0" steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup if: inputs.do-build == 'true' - uses: actions/checkout@v4 with: diff --git a/.github/workflows/push-image-cache.yml b/.github/workflows/push-image-cache.yml index 436526694b..97c0d517c2 100644 --- a/.github/workflows/push-image-cache.yml +++ b/.github/workflows/push-image-cache.yml @@ -91,8 +91,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMIT_SHA: ${{ github.sha }} steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -145,5 +145,3 @@ jobs: breeze prod-image build --tag-as-latest --install-packages-from-context --push --python ${{ matrix.python}} --platform "linux/amd64" if: inputs.push-latest-images == 'true' - - name: "Clean docker cache for ${{ matrix.platform }}" - run: docker system prune --all --force diff --git a/.github/workflows/release_dockerhub_image.yml b/.github/workflows/release_dockerhub_image.yml index 3d6d4e065e..7a0a1f5f7e 100644 --- a/.github/workflows/release_dockerhub_image.yml +++ b/.github/workflows/release_dockerhub_image.yml @@ -54,8 +54,8 @@ jobs: GITHUB_CONTEXT: ${{ toJson(github) }} VERBOSE: true steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: @@ -90,8 +90,8 @@ jobs: "potiuk", ]'), github.event.sender.login) steps: - - name: Cleanup repo - run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*" + - name: Cleanup + uses: ./.github/actions/cleanup - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 with: