From aed41c1277827a01ad47f165f7ef86d7e93bcb68 Mon Sep 17 00:00:00 2001 From: Markus Dobel Date: Tue, 28 Nov 2023 12:25:32 +0100 Subject: [PATCH 1/3] fix: run find with root permissions --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c03bcbc..a32c3ca 100644 --- a/action.yml +++ b/action.yml @@ -113,7 +113,7 @@ runs: # ensure mount path exists before the action sudo mkdir -p "${BUILD_MOUNT_PATH}" - find "${BUILD_MOUNT_PATH}" -maxdepth 0 ! -empty -exec echo 'WARNING: directory [{}] is not empty, data loss might occur. Content:' \; -exec ls -al "{}" \; + sudo find "${BUILD_MOUNT_PATH}" -maxdepth 0 ! -empty -exec echo 'WARNING: directory [{}] is not empty, data loss might occur. Content:' \; -exec ls -al "{}" \; echo "Removing unwanted software... " if [[ ${{ inputs.remove-dotnet }} == 'true' ]]; then From 557cb009e7800b893a76650025e3fb5e9703cd1e Mon Sep 17 00:00:00 2001 From: Markus Dobel Date: Tue, 28 Nov 2023 12:26:07 +0100 Subject: [PATCH 2/3] test: add test for root-owned build path --- .github/workflows/test.yaml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c05c454..92071a9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,8 +16,22 @@ env: REPORT_DIR: /tmp/build-report jobs: - test-action: - name: Test action + test-docker-tmp: + name: Test removing root-owned folder + runs-on: ubuntu-latest + steps: + - name: Check out Maximize Build Space action + uses: actions/checkout@v4 + with: + path: ./.github/actions/maximize-test + + - name: Maximize build space + uses: ./.github/actions/maximize-test + with: + build-mount-path: /var/lib/docker/tmp + + determine-free-space: + name: Determine free space with different settings runs-on: ${{ matrix.os }} strategy: @@ -117,7 +131,7 @@ jobs: collect-reports: name: Collect reports runs-on: ubuntu-latest - needs: test-action + needs: determine-free-space env: REPORT_FILE: space-free-report.md From fe0431d2ea5d3f901672ecc5e5d3321a5aab0d4b Mon Sep 17 00:00:00 2001 From: Markus Dobel Date: Tue, 28 Nov 2023 12:37:20 +0100 Subject: [PATCH 3/3] fix: run free space reports with sudo as well --- action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index a32c3ca..b956952 100644 --- a/action.yml +++ b/action.yml @@ -65,13 +65,13 @@ runs: shell: bash run: | echo "Memory and swap:" - free + sudo free echo - swapon --show + sudo swapon --show echo echo "Available storage:" - df -h + sudo df -h echo - name: Maximize build disk space @@ -189,10 +189,10 @@ runs: shell: bash run: | echo "Memory and swap:" - free + sudo free echo - swapon --show + sudo swapon --show echo echo "Available storage:" - df -h + sudo df -h