Skip to content
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

PR to make purge script more robust for MacOS #18192

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

siddarthkay
Copy link
Contributor

The existing purge script for Darwin would fail and stop at many stages.

This PR makes the script more robust to certain failures that were observed and documented in #16404

fixes #16404

status: ready

@siddarthkay siddarthkay self-assigned this Dec 14, 2023
@siddarthkay siddarthkay linked an issue Dec 14, 2023 that may be closed by this pull request
@status-im-auto
Copy link
Member

status-im-auto commented Dec 14, 2023

Jenkins Builds

Click to see older builds (8)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6f7fd7c #1 2023-12-14 18:08:36 ~5 min tests 📄log
✔️ 6f7fd7c #1 2023-12-14 18:10:12 ~6 min ios 📱ipa 📲
✔️ 6f7fd7c #1 2023-12-14 18:11:50 ~8 min android-e2e 🤖apk 📲
✔️ 6f7fd7c #1 2023-12-14 18:11:56 ~8 min android 🤖apk 📲
✔️ 68df406 #3 2023-12-15 07:16:21 ~4 min tests 📄log
✔️ 68df406 #3 2023-12-15 07:18:51 ~6 min android-e2e 🤖apk 📲
✔️ 68df406 #3 2023-12-15 07:19:00 ~6 min android 🤖apk 📲
✔️ 68df406 #3 2023-12-15 07:25:45 ~13 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d6c978a #4 2023-12-18 11:04:25 ~5 min tests 📄log
✔️ d6c978a #4 2023-12-18 11:05:39 ~6 min ios 📱ipa 📲
✔️ d6c978a #4 2023-12-18 11:07:30 ~8 min android-e2e 🤖apk 📲
✔️ d6c978a #4 2023-12-18 11:07:36 ~8 min android 🤖apk 📲
✔️ df488c7 #6 2023-12-19 03:04:58 ~4 min tests 📄log
✔️ df488c7 #6 2023-12-19 03:08:21 ~7 min android-e2e 🤖apk 📲
✔️ df488c7 #6 2023-12-19 03:08:28 ~7 min android 🤖apk 📲
✔️ df488c7 #6 2023-12-19 03:14:45 ~13 min ios 📱ipa 📲

@siddarthkay siddarthkay changed the title PR to make purge script more robust PR to make purge script more robust for MacOS Dec 14, 2023
@siddarthkay siddarthkay force-pushed the fix-nix-purge-script branch 2 times, most recently from b06e9f7 to 68df406 Compare December 15, 2023 07:11
Copy link
Contributor

@BalogunofAfrica BalogunofAfrica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@siddarthkay siddarthkay force-pushed the fix-nix-purge-script branch 2 times, most recently from d6c978a to 08fe08c Compare December 19, 2023 02:59
@siddarthkay siddarthkay merged commit 771fb11 into develop Dec 19, 2023
6 checks passed
@siddarthkay siddarthkay deleted the fix-nix-purge-script branch December 19, 2023 03:16
@siddarthkay
Copy link
Contributor Author

@status-im/mobile-qa : merged without QA because this change only effects local dev environments.

Comment on lines +52 to +62
echo "The volume /nix is in use by process ID $pid."

# Ask the user whether to terminate the process
read -p "Do you want to terminate this process? (y/n): " choice
if [[ $choice == "y" ]]; then
sudo kill $pid
echo "Process $pid terminated."
else
echo "Process not terminated. Please close it manually and retry."
return 1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole thing should be a function. Or even a separate scripts/kill_proc_prompt.sh.

Comment on lines +28 to +29
sudo launchctl unload "${NIX_SERVICE}" || true
sudo launchctl remove "${NIX_SERVICE}" || true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't "robust", this is just ignoring failures.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to understand why unload would fail.

Comment on lines +74 to +76
nix_purge_darwin_multi_user_service || true
nix_purge_darwin_multi_user_users || true
nix_purge_darwin_multi_user_volumes || true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this is not "robust", it just ignores failures and continues.

@jakubgs
Copy link
Member

jakubgs commented Jan 2, 2024

I do not like any of the || true stuff you added, it needs to be fixed.

@siddarthkay
Copy link
Contributor Author

@jakubgs : I agree with your review on this PR, the intent back then was to make sure that the purge script would run without exiting when it encountered any failures and so that the devs would be able to purge nix via this script without the need for any manual intervention.

I created #18360 to detail out the issues with the existing steps so that we can perform a proper fix.

Thank you

siddarthkay added a commit that referenced this pull request Jan 30, 2024
## Summary
In this commit we : 
- instead of `cd` to `/Library/LaunchDaemons` and then attempting to `launchctl unload` the nixos plist files we just pass the full path to unload as seen in `nix` documentation here : https://nixos.org/manual/nix/stable/installation/uninstall.html#:~:text=Stop%20and%20remove%20the%20Nix%20daemon%20services%3A

- move killing a process by prompting for confirmation to a new shell script as per feedback from previous PR : #18192 (comment)

- fix few small typos

## Platforms
- macOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

issues with nix purge script
4 participants