Get repeated install working in CI

This commit is contained in:
Ana Hobden 2022-11-09 09:25:29 -08:00
parent 71e63da4e4
commit a7ab480eea
4 changed files with 27 additions and 6 deletions

View file

@ -101,6 +101,10 @@ jobs:
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
- name: Repeated install
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --no-confirm
- name: Repeated test run
run: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
nix run nixpkgs#fortune
- name: Repeated uninstall
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
@ -140,6 +144,10 @@ jobs:
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
- name: Repeated install
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm
- name: Repeated test run
run: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
nix run nixpkgs#fortune
- name: Repeated uninstall
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm

View file

@ -132,6 +132,15 @@ impl Action for ConfigureNixDaemonService {
execute_command(Command::new("systemctl").arg("daemon-reload"))
.await
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
execute_command(
Command::new("systemctl")
.arg("enable")
.arg("--now")
.arg("nix-daemon.socket"),
)
.await
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
},
};
@ -181,11 +190,11 @@ impl Action for ConfigureNixDaemonService {
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
},
_ => {
execute_command(Command::new("systemctl").args(["disable", SOCKET_SRC]))
execute_command(Command::new("systemctl").args(["disable", SOCKET_SRC, "--now"]))
.await
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
execute_command(Command::new("systemctl").args(["disable", SERVICE_SRC]))
execute_command(Command::new("systemctl").args(["disable", SERVICE_SRC, "--now"]))
.await
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;

View file

@ -90,9 +90,13 @@ impl Action for StartSystemdUnit {
tracing::debug!("Stopping systemd unit");
// TODO(@Hoverbear): Handle proxy vars
execute_command(Command::new("systemctl").arg("stop").arg(format!("{unit}")))
.await
.map_err(|e| StartSystemdUnitError::Command(e).boxed())?;
execute_command(
Command::new("systemctl")
.arg("disable")
.arg(format!("{unit}")),
)
.await
.map_err(|e| StartSystemdUnitError::Command(e).boxed())?;
tracing::trace!("Stopped systemd unit");
*action_state = ActionState::Completed;

View file

@ -31,7 +31,7 @@ impl Planner for LinuxMulti {
Box::new(CreateDirectory::plan("/nix", None, None, 0o0755, true).await?),
Box::new(ProvisionNix::plan(self.settings.clone()).await?),
Box::new(ConfigureNix::plan(self.settings).await?),
Box::new(StartSystemdUnit::plan("nix-daemon.socket".into()).await?),
// Box::new(StartSystemdUnit::plan("nix-daemon.socket".into()).await?),
],
})
}