ci: clear out space on CentOS, depends, gui GHA job #33514

pull willcl-ark wants to merge 1 commits into bitcoin:master from willcl-ark:centos-space-fix changing 2 files +16 −0
  1. willcl-ark commented at 2:04 pm on October 1, 2025: member

    Fixes #33293

    Clear out space on jobs running on GHA by deleteing unnecessary files.

    Raised in #33293 which pointed to a solution like https://github.com/google/oss-fuzz/commit/b7f04d782277638a67bc44865de445977eed4708 which is adapted slightly here.

    Only runs when cache provider (runner) is gha.

    A run on my fork can be seen here: https://github.com/willcl-ark/bitcoin/actions/runs/19703413734/job/56444984809

  2. DrahtBot commented at 2:04 pm on October 1, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33514.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, janb84, m3dwards
    Concept ACK hebasto
    Stale ACK pablomartin4btc, hodlinator

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    Conflicts

    No conflicts as of last run.

  3. willcl-ark commented at 2:06 pm on October 1, 2025: member

    Maintaining an action in this repo which only caters to forks is not ideal, but unless GH increases the space on runners, or provides a “slim” image variant, then it might be the best there is for now.

    As it doesn’t run in this repo it should at least never break our CI.

  4. katesalazar commented at 2:21 pm on October 1, 2025: contributor
    Which one is the chain needing this change?
  5. janb84 commented at 2:22 pm on October 1, 2025: contributor
    So how does this relate to #33480 (remove centos for alpine) . Is this a fix until that PR gets merged ?
  6. willcl-ark commented at 2:23 pm on October 1, 2025: member

    Which one is the chain needing this change?

    Ah I was slightly unclear; this actually applies to “personal forks” (e.g. my own, your own) as well as actual coin-forks. Anywhere where Cirrus runners, which have more space, are not being used.

    So how does this relate to #33480 (remove centos for alpine) . Is this a fix until that PR gets merged ?

    I had thought the alpine job would use less space, but I think they are ~ equivalent, so this fix is still needed on that job for runs on forks (see above) to not run out of space.

  7. janb84 commented at 2:55 pm on October 1, 2025: contributor

    ACK 014b9f6268390b78e66e1be24813d3f069588442

    PR introduces new CI action. This action will remove unnecessary packages to reduce space. This action will only run on GHA runners and will save about 22gb.

    Kinda surprised about the space savings or why are the packages are there in the first place. Anyhow this will help to resolve the GHA space problems for Centos job. (resolves #33293)

    EDIT: It’s now more clear that the files are removed of the GHA runner image/host.

  8. fanquake commented at 9:26 pm on October 3, 2025: member
  9. in .github/workflows/ci.yml:521 in 014b9f6268
    516@@ -516,6 +517,10 @@ jobs:
    517         with:
    518           cache-provider: ${{ matrix.provider || needs.runners.outputs.provider }}
    519 
    520+      - name: Clear unnecessary files
    521+        if: ${{ matrix.freeup-space == true }}
    


    maflcko commented at 2:50 pm on October 4, 2025:
    0        if: ${{ needs.runners.outputs.provider == 'gha' }}
    

    nit: Could run it for all tasks, to avoid having to select them individually?


    hodlinator commented at 7:50 am on October 6, 2025:

    Don’t see a problem with the current approach. Would just prefer:

    0        if: ${{ matrix.freeup-space }}
    

    maflcko commented at 8:19 am on October 6, 2025:

    Don’t see a problem with the current approach.

    The problem is that GHA does not run in this repo, so there likely won’t be any indication when this setting is needed. It can practically most likely only be removed/added in a follow-up, which increases the churn a bit.

    If the overhead is too large, the step could be run in the background, albeit that would be dropping the reporting feature.

    No strong opinion, though, just wanted to mention it.


    willcl-ark commented at 8:25 am on October 6, 2025:

    Yeah it’s a fair shout.

    The step in my run in OP took 4 mins, but I have seen it also take 2 minutes. Either way that’s “wasted time” on the run, although this doesn’t particularly matter on a fork run IMO, as they’re way less time-sensitive, less likely to be queued up with a backlog (and using free compute).

    When each job is takining in the order of 1-2 hours, adding 4 minutes on doesnt’ feel that problematic to me.


    willcl-ark commented at 8:33 am on October 6, 2025:

    nit: Could run it for all tasks, to avoid having to select them individually?

    OK I took this suggestion in c01214e72b9876c59924c98e96f43906f5df3353 as the future-proofing/churn-reduction seems worth it.

  10. maflcko approved
  11. maflcko commented at 2:53 pm on October 4, 2025: member
    lgtm. left a comment to avoid churn in the future and one of the merge conflicts.
  12. pablomartin4btc commented at 0:28 am on October 6, 2025: member
  13. in .github/workflows/ci.yml:485 in 014b9f6268 outdated
    481@@ -482,6 +482,7 @@ jobs:
    482             fallback-runner: 'ubuntu-24.04'
    483             timeout-minutes: 120
    484             file-env: './ci/test/00_setup_env_native_centos.sh'
    485+            freeup-space: ${{ needs.runners.outputs.provider == 'gha' && true || false }} # Only needed on hosted GH runners (forks)
    


    hodlinator commented at 7:46 am on October 6, 2025:

    nit: Remove leftovers, unless they serve a purpose?

    0            freeup-space: ${{ needs.runners.outputs.provider == 'gha' }} # Only needed on hosted GH runners (forks)
    

    willcl-ark commented at 8:36 am on October 6, 2025:
    Removed line altogether as we now run on all jobs on GHA

    hodlinator commented at 11:04 am on October 8, 2025:
    (Would be nice to clear this up since you switched back to this commit).
  14. hodlinator approved
  15. hodlinator commented at 8:14 am on October 6, 2025: contributor

    ACK 014b9f6268390b78e66e1be24813d3f069588442

    Was curious if it would take less time to switch to the stream10-minimal container, but it seems to come with the same amount of /usr/local/lib/android files, taking over 3min to remove regardless (https://github.com/hodlinator/bitcoin/actions/runs/18273895919/job/52021497688#step:6:249).

    Edit: Just realized the /usr/local/lib/android being removed exists on the host Ubuntu OS, not inside the CentOS container.

  16. maflcko commented at 8:21 am on October 6, 2025: member

    Was curious if it would take less time to switch to the stream10-minimal container,

    Just for reference, the added step here runs before any of the CI logic is run, so changing the CI config should not have any effect on this step here.

  17. hodlinator commented at 8:23 am on October 6, 2025: contributor

    Was curious if it would take less time to switch to the stream10-minimal container,

    Just for reference, the added step here runs before any of the CI logic is run, so changing the CI config should not have any effect on this step here.

    Yeah, just realized /usr/local/lib/android was being removed on the host OS, not inside the container.

  18. willcl-ark force-pushed on Oct 6, 2025
  19. willcl-ark renamed this:
    Clear out space on centos job
    Clear out space on GHA jobs
    on Oct 6, 2025
  20. willcl-ark force-pushed on Oct 6, 2025
  21. janb84 commented at 12:19 pm on October 6, 2025: contributor

    re ACK c01214e72b9876c59924c98e96f43906f5df3353

    Changes sinds last ACK:

    • changed precondition test for action step.
    • removed superfluous line that sets a (now unused) variable

    I like the solution because the alternative would be to create an custom GHA Image (as suggested by gh) which would be a more maintenance burden than this script.

  22. DrahtBot requested review from pablomartin4btc on Oct 6, 2025
  23. DrahtBot requested review from hodlinator on Oct 6, 2025
  24. fanquake commented at 12:26 pm on October 6, 2025: member

    A run applying to all jobs when using GHA can be seen here: https://github.com/willcl-ark/bitcoin/actions/runs/18274913987

    Looking there, it seems like the cleanup step can take up to 10 minutes to complete i.e. https://github.com/willcl-ark/bitcoin/actions/runs/18274913987/job/52024710440. Although I guess that is less of an issue if it’s not running in this repo.

  25. willcl-ark commented at 12:35 pm on October 6, 2025: member

    A run applying to all jobs when using GHA can be seen here: willcl-ark/bitcoin/actions/runs/18274913987

    Looking there, it seems like the cleanup step can take up to 10 minutes to complete i.e. willcl-ark/bitcoin/actions/runs/18274913987/job/52024710440. Although I guess that is less of an issue if it’s not running in this repo.

    This is even longer than I’ve seen it take previously. Happy to revert this to only apply to the CentOS job if preferred. Seems pointless to add 10 mins runtime onto like 11 jobs where it’s not needed…

  26. hodlinator approved
  27. hodlinator commented at 9:05 pm on October 6, 2025: contributor

    re-ACK c01214e72b9876c59924c98e96f43906f5df3353

    I’m okay with applying broadly to ease maintenance, with a very slight preference for changing it back to more surgically apply to CentOS.

  28. janb84 commented at 7:59 am on October 7, 2025: contributor

    A run applying to all jobs when using GHA can be seen here: https://github.com/willcl-ark/bitcoin/actions/runs/18274913987

    Looking there, it seems like the cleanup step can take up to 10 minutes to complete i.e. https://github.com/willcl-ark/bitcoin/actions/runs/18274913987/job/52024710440. Although I guess that is less of an issue if it’s not running in this repo.

    Ok I missed this in my review, I also have a slight preference to revert this to only apply to the CentOS job. I would say lets revert and if the cleanup action needs to be applied on more actions in the future, then go for the generic solution (as applied now) to reduce churn.

  29. m3dwards commented at 2:49 pm on October 7, 2025: contributor

    I wondered if it could be sped up and it looks like deleting /usr/local/lib/android is what takes the time. It’s 9.8gb so probably not worth skipping the deletion. I tried a few tricks like rsyncing an empty directory over it but it looks like rm -rf is king in terms of speed.

    So I concur, perhaps best to just apply to the job that needs it.

  30. Sjors referenced this in commit 42a69f6e05 on Oct 8, 2025
  31. in .github/workflows/ci.yml:520 in c01214e72b
    515@@ -516,6 +516,10 @@ jobs:
    516         with:
    517           cache-provider: ${{ matrix.provider || needs.runners.outputs.provider }}
    518 
    519+      - name: Clear unnecessary files
    520+        if: ${{ needs.runners.outputs.provider == 'gha' }}
    


    Sjors commented at 10:09 am on October 8, 2025:
    Is this automatically set?

    willcl-ark commented at 10:18 am on October 8, 2025:

    Yes, this is set by the determine-runners job: https://github.com/bitcoin/bitcoin/blob/b510893d00760083ac36948747aa6ebd84656192/.github/workflows/ci.yml#L33-L46

    If you have cirrus runners in your own repo you can set a repo variable REPO_USE_CIRRUS_RUNNERS to your repo name to enable cirrus runners in your fork.


    willcl-ark commented at 10:19 am on October 8, 2025:

    You will see the setting in the Annotations section of the Actions tab on a run:

  32. willcl-ark force-pushed on Oct 8, 2025
  33. Sjors referenced this in commit 3a4a0884d1 on Oct 8, 2025
  34. Sjors commented at 11:16 am on October 8, 2025: member

    Happy to revert this to only apply to the CentOS job if preferred. Seems pointless to add 10 mins runtime onto like 11 jobs where it’s not needed…

    While testing on with sv2-tp https://github.com/Sjors/sv2-tp/pull/37 I also noticed the cleanup task is quite slow. Because my codebase is much smallers, it basically doubles the runtime. Of course I could simply not cherry-pick this commit - I haven’t run out of space yet - but just FYI.

  35. Sjors referenced this in commit 0a4f1d3728 on Oct 8, 2025
  36. Sjors referenced this in commit 6c2dba678d on Oct 8, 2025
  37. janb84 commented at 3:09 pm on October 13, 2025: contributor

    re ACK 014b9f6268390b78e66e1be24813d3f069588442

    changes since last ack:

    • The PR is back to only running the Clear unnecessary files action on the 'CentOS, depends, gui'
  38. DrahtBot added the label Needs rebase on Oct 15, 2025
  39. maflcko commented at 4:13 pm on November 18, 2025: member

    Can this be closed, or is there something left to be done here?

    Looks like a lot of hassle/bike-shedding for something that hasn’t happened for about a month now.

  40. willcl-ark commented at 4:24 pm on November 18, 2025: member
    Closing for now
  41. willcl-ark closed this on Nov 18, 2025

  42. m3dwards commented at 3:19 pm on November 20, 2025: contributor
  43. willcl-ark renamed this:
    Clear out space on GHA jobs
    Clear out space on CentOS, depends, gui GHA job
    on Nov 20, 2025
  44. willcl-ark commented at 8:47 pm on November 20, 2025: member

    Hitting this again on my and @TheCharlatan’s fork: m3dwards/bitcoin/actions/runs/19539048875/job/55940226257

    Re-opening based on above report, can close again if someone else has another approach they would prefer.

  45. willcl-ark reopened this on Nov 20, 2025

  46. maflcko removed the label Needs rebase on Nov 20, 2025
  47. DrahtBot added the label Needs rebase on Nov 20, 2025
  48. in .github/actions/clear-files/action.yml:11 in 014b9f6268
     6+    - name: Clear unnecessary files
     7+      shell: bash
     8+      env:
     9+        DEBIAN_FRONTEND: noninteractive
    10+      run: |
    11+        set +e
    


    maflcko commented at 8:16 am on November 26, 2025:
    0        set +o errexit
    

    nit: Would be nice to use the long names, so that the code can be understood without looking up the long name in the manual.


    willcl-ark commented at 2:21 pm on November 26, 2025:
    taken this suggestion in e07e57368e9fab8ecfc140d44aef7db9b23c7ce0. Thanks!
  49. in .github/actions/clear-files/action.yml:23 in 014b9f6268
    18+        BEFORE_AVAIL=$(df / | awk 'NR==2 {print $4}')
    19+
    20+        echo "Cleaning up unnecessary packages..."
    21+        time sudo apt-get remove --purge -y firefox google-chrome-stable powershell
    22+        time sudo apt-get autoremove -y
    23+        time sudo apt-get clean
    


    maflcko commented at 8:20 am on November 26, 2025:
    Does this clear any meaningful space? Could maybe remove, if not?

    willcl-ark commented at 2:22 pm on November 26, 2025:
    removed in e07e57368e9fab8ecfc140d44aef7db9b23c7ce0
  50. in .github/actions/clear-files/action.yml:45 in 014b9f6268
    40+        done
    41+
    42+        echo "Disabling swap"
    43+        sudo swapoff -a
    44+        sudo rm -f /swapfile
    45+
    


    maflcko commented at 8:21 am on November 26, 2025:
    Will this then lead to OOM instead?

    willcl-ark commented at 2:21 pm on November 26, 2025:
    Not relevant any more since e07e57368e9fab8ecfc140d44aef7db9b23c7ce0
  51. maflcko commented at 8:26 am on November 26, 2025: member

    left some nits.

    I guess I don’t understand why this one takes 5 minutes, but basically the same takes 1 minute in https://github.com/hebasto/bitcoin-core-nightly/actions/runs/19678632177/job/56366955874?pr=91#step:3:1.

    I don’t have a strong opinion, but I still think this is better run on all tasks, and constantly maintaining which task needs it (or can it have removed) does not seem like a good use of time?

    If the duration is a concern, all of this could be replaced with a one-line background task: sudo bash -c '(ionice -c 3 nice -n 19 rm -rf /usr/share/dotnet/ /usr/local/graalvm/ /usr/local/.ghcup/ /usr/local/share/powershell /usr/local/share/chromium /usr/local/lib/android /usr/local/lib/node_modules)&'

  52. hebasto commented at 2:16 pm on November 26, 2025: member

    @willcl-ark

    Please rebase.

  53. ci: clear out space on centos job
    Clear out space on the centos job be deleteing unnecessary files.
    
    Raised by #33293 which pointed to a solution like https://github.com/google/oss-fuzz/commit/b7f04d782277638a67bc44865de445977eed4708
    
    Only runs when cache provider (runner) is `gha`, and on the CentOS job.
    e07e57368e
  54. willcl-ark force-pushed on Nov 26, 2025
  55. hebasto commented at 2:18 pm on November 26, 2025: member
    Concept ACK. A similar approach was used in https://github.com/hebasto/bitcoin-core-nightly/pull/91.
  56. willcl-ark commented at 2:20 pm on November 26, 2025: member

    @willcl-ark

    Please rebase.

    Sorry, was waiting to see if @maflcko ’s background task approach works before adopting it here. I tested it in my fork here where it appears to have worked successfully.

    So I have pushed e07e57368e9fab8ecfc140d44aef7db9b23c7ce0 here which:

    • applies the clearout to all jobs (on gha runners`)
    • runs the task in the background
    • takes the suggested command from #33514#pullrequestreview-3509596228
  57. maflcko commented at 2:23 pm on November 26, 2025: member

    lgtm ACK e07e57368e9fab8ecfc140d44aef7db9b23c7ce0

    Missing ci: prefix in the title?

  58. DrahtBot requested review from janb84 on Nov 26, 2025
  59. DrahtBot requested review from hodlinator on Nov 26, 2025
  60. DrahtBot requested review from hebasto on Nov 26, 2025
  61. willcl-ark renamed this:
    Clear out space on CentOS, depends, gui GHA job
    ci: clear out space on CentOS, depends, gui GHA job
    on Nov 26, 2025
  62. DrahtBot removed the label Needs rebase on Nov 26, 2025
  63. DrahtBot added the label Tests on Nov 26, 2025
  64. janb84 commented at 3:03 pm on November 26, 2025: contributor

    ACK e07e57368e9fab8ecfc140d44aef7db9b23c7ce0

    Clever to run the removal in the background ! I was wondering where the output goes but that goes no-where (A thing to keep in mind for the future when we are debugging this)

    We could even go a bit more aggressive (if needed) and delete /usr/local/.ghcup(6gb) and others

  65. m3dwards commented at 3:57 pm on November 26, 2025: contributor

    ACK e07e57368e9fab8ecfc140d44aef7db9b23c7ce0

    Like that it runs in the background, dislike that it hides any errors. It’s simple enough that I don’t think it’s worth being more complex to catch any problems.

    As an experiment I removed CMakeFiles directories after cmake ran which deletes a few GBs in under a second which was just enough to get my fork building again. I prefer the solution in this PR however.

    Relevant log output (full log):

    0Tue, 25 Nov 2025 21:15:42 GMT
    17.6G	/home/runner/work/_temp/build
    2Tue, 25 Nov 2025 21:15:42 GMT
    3+ find /home/runner/work/_temp/build -type d -name CMakeFiles -exec rm -rf '{}' +
    4Tue, 25 Nov 2025 21:15:42 GMT
    5+ du -sh /home/runner/work/_temp/build
    6Tue, 25 Nov 2025 21:15:42 GMT
    74.7G	/home/runner/work/_temp/build
    
  66. fanquake merged this on Nov 27, 2025
  67. fanquake closed this on Nov 27, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-02 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me