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

Feature/daemon #161

Merged
merged 38 commits into from
Jan 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9fc79cc
Add an option to push using the Cachix Daemon
sandydoo Aug 15, 2023
ff0dffc
Turn useDaemon into a boolean
sandydoo Aug 15, 2023
b5f72d0
Stop the daemon with "cachix daemon stop"
sandydoo Aug 15, 2023
e65e5be
Cleanup
sandydoo Aug 16, 2023
f0bab2b
Use NIX_USER_CONF_FILES to add the daemon post-build-hook
sandydoo Aug 18, 2023
24bcb9c
Commit dist script
sandydoo Aug 18, 2023
52b9548
Add a daemon test
sandydoo Aug 18, 2023
3c84c09
Improve daemon error handling
sandydoo Aug 21, 2023
8ac4463
Print daemon pid in debug mode
sandydoo Aug 21, 2023
94114e9
Commit dist script
sandydoo Aug 21, 2023
4bbc433
Read isPost state with getState
sandydoo Aug 21, 2023
c497602
Close the log tail on errors
sandydoo Aug 21, 2023
5cf431c
Pass the cachix bin to the post run action
sandydoo Aug 21, 2023
f25ee2d
Fix the installCommand
sandydoo Oct 6, 2023
703af95
Add a 'cachixBin' option to override the cachix binary
sandydoo Oct 23, 2023
e2f9a65
Add checks for daemon support
sandydoo Oct 23, 2023
52c0559
Add types for semver
sandydoo Oct 23, 2023
a2fa96b
Fix version check
sandydoo Oct 23, 2023
866101a
ci: update daemon-supporting cachix
sandydoo Oct 23, 2023
b5718b4
Load the default nix conf files when registering the daemon hook
sandydoo Oct 23, 2023
85c7fe7
ci: verify that caches are set up in daemon mode
sandydoo Oct 23, 2023
53eb1b0
Improve the nix.conf loading logic when using daemon mode
sandydoo Oct 24, 2023
971ef34
Use the latest daemon during development
sandydoo Oct 24, 2023
e8d3770
daemon: fix word splitting issue breaking multi-path pushes
sandydoo Dec 6, 2023
6b58bdd
daemon: register the post-build-hook with NIX_CONF if necessary
sandydoo Dec 27, 2023
67d3814
daemon: update official deamon support bounds
sandydoo Jan 9, 2024
4386350
daemon: verify that the user can set post-build-hooks
sandydoo Jan 9, 2024
5f93ae3
daemon: enable the daemon by default
sandydoo Jan 9, 2024
108c128
daemon: fixup exec usage
sandydoo Jan 9, 2024
0f0c7f6
daemon: silence some exec commands
sandydoo Jan 9, 2024
64b052b
daemon: avoid file handle GC warning
sandydoo Jan 9, 2024
8426524
daemon: check for credentials early
sandydoo Jan 9, 2024
711a732
daemon: fix reading trusted-users
sandydoo Jan 9, 2024
608ce1e
daemon: add debugging logs to trusted user logic
sandydoo Jan 9, 2024
11a95a7
daemon: resolve promise
sandydoo Jan 9, 2024
a7c8acb
daemon: add even more logging to trusted user logic
sandydoo Jan 9, 2024
3a94fae
daemon: update tests
sandydoo Jan 12, 2024
e54c44c
daemon: drop latest daemon installer
sandydoo Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Read isPost state with getState
sandydoo committed Jan 9, 2024
commit 4bbc433ab486e3dd587ec6f31f58ceb9c09af2a8
10 changes: 6 additions & 4 deletions dist/main/index.js
Original file line number Diff line number Diff line change
@@ -4697,7 +4697,7 @@ async function setup() {
if (typeof daemon.pid === 'number') {
const pid = daemon.pid.toString();
core.debug(`Spawned Cachix Daemon with PID: ${pid}`);
await fs.writeFile(`${daemonDir}/daemon.pid`, pid);
await fs.writeFile(pidFilePath(daemonDir), pid);
}
else {
core.error('Failed to spawn Cachix Daemon');
@@ -4755,8 +4755,7 @@ async function upload() {
core.debug('Cachix Daemon not started. Skipping push');
return;
}
const daemonPidPath = path.join(daemonDir, 'daemon.pid');
const daemonPid = parseInt(await fs.readFile(daemonPidPath, { encoding: 'utf8' }));
const daemonPid = parseInt(await fs.readFile(pidFilePath(daemonDir), { encoding: 'utf8' }));
if (!daemonPid) {
core.error('Failed to find PID of Cachix Daemon. Skipping push.');
return;
@@ -4784,7 +4783,10 @@ async function upload() {
}
core.endGroup();
}
const isPost = !!process.env['STATE_isPost'];
function pidFilePath(daemonDir) {
return path.join(daemonDir, 'daemon.pid');
}
const isPost = !!core.getState('isPost');
// Main
if (!isPost) {
// Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
11 changes: 7 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ async function setup() {
if (typeof daemon.pid === 'number') {
const pid = daemon.pid.toString();
core.debug(`Spawned Cachix Daemon with PID: ${pid}`);
await fs.writeFile(`${daemonDir}/daemon.pid`, pid);
await fs.writeFile(pidFilePath(daemonDir), pid);
} else {
core.error('Failed to spawn Cachix Daemon');
return;
@@ -158,8 +158,7 @@ async function upload() {
return;
}

const daemonPidPath = path.join(daemonDir, 'daemon.pid');
const daemonPid = parseInt(await fs.readFile(daemonPidPath, { encoding: 'utf8' }));
const daemonPid = parseInt(await fs.readFile(pidFilePath(daemonDir), { encoding: 'utf8' }));

if (!daemonPid) {
core.error('Failed to find PID of Cachix Daemon. Skipping push.');
@@ -192,7 +191,11 @@ async function upload() {
core.endGroup();
}

const isPost = !!process.env['STATE_isPost']
function pidFilePath(daemonDir: string) {
return path.join(daemonDir, 'daemon.pid');
}

const isPost = !!core.getState('isPost');

// Main
if (!isPost) {