-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
enhancement(ci): cleanup already built packages if no disk space left #23527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aca6ed6 to
53bc2a3
Compare
|
CI finished building so I assume the solution works fine. I will merge it in ~10 hours or after it gets 2+ approves. |
53bc2a3 to
67d913b
Compare
|
This behavior should be enabled for ci with a env variable, not for local builds. Users may be building bootstrap with lot of packages, which may need to be rebuilt again, and deleting built files is a no go. |
|
Zzz breaks on device build |
i can't think of a scenario in which building a bootstrap locally with this change would cause packages to be rebuilt multiple times, is that what you meant or do you mean something a little different? If you mean that someone might be editing the code of packages and somehow repeatedly recompiling them intentionally without storing the changes as |
In code I wrote in the past, there is a block for detecting available space on device that has been very heavily tested on many of my devices and others' devices, so it should not be affected by the same problem on any device. I'm sorry I should have mentioned it earlier but I forgot about it. BLOCKS_FREE=$(awk -F ' ' '{print $4}' <(df ~ | tail -1))
if (( 5242880 > BLOCKS_FREE )); then
echo "less than 5 GB available"
fiif you end up keeping the |
|
We already use
|
Could we replace that magic number with a named constant, or a equation and comment, or both. |
df outputs size in 1024 byte blocks. So `$(( 5 * 1024 ** 2 )). |
|
forgot again |
If you delete output directory with debs, then packages need to be rebuilt, and if you delete build progress, builds will start from scratch, which can take hours. Additionally, free disk space can vary on mobile device/docker, etc, and cleanup may not be required anyways for small packages. Any deletion should not be automatic, even force builds that cleanup packages require |
|
I do not see an option to pass environment variable from CI to |
|
termux-packages/.github/workflows/packages.yml Lines 230 to 234 in 7d05e79
|
|
Yes, I've seen it. But in this case |
i might be wrong, but i did not think this change deletes the output directory with debs.
I agree with this concept, but I was not sure how important it is in this situation since twaik moved forward with a version that always runs regardless of whether it is in CI or not. If you think that this concept is very important to make sure that the data of people who are building packages with unknown custom configurations locally is not lost, then I agree with your opinion. |
It does not.
I agree too, but currently I am not really sure how to make it cleanup packages only in CI. |
No it wont, but if someone deletes the deb/output directory as there are older or unneeded debs, etc, and then wants to rebuild them again, in that case if built progress was lost, then it will require rebuilding everything from scratch. Yes, this cleanup must not be automatic. It needs to be specifically enabled for CI or if a user wants to. |
It would be necessary to edit |
So how exactly should it be enabled? With additional argument or environment variable or something similar? |
Pass an additional flag just like |
|
Pass a flag like |
|
@agnostic-apollo I pushed this change to #23530 as a part of fixing on-device building. |
|
Thanks, should be fine. Continue build help entry will need to be removed from my pull though. |
It would be an absolute honor if you hit that 'Approve' button for me! (I still not decided if it should be a joke or I am serious, but anyway it will be a pleasure to me). |
|
lolz, there are other changes I haven't reviewed, I am away from laptop right now. You can consider the part of the flag as approved. |
Since this change is more or less harmless and will not affect most build cases except batch rebuilding I am going to merge this in 12 hours if there are no objections.
Also in this PR I am bumping abseil-cpp to test if cleaning up works because there are enough packages being rebuilt to fill the whole disk during CI run.