mirror of
https://github.com/DeterminateSystems/nix-installer-action.git
synced 2024-11-26 03:08:10 +03:00
action: post-run-job: try clean daemon container, warn on failure (#61)
* flake: add typescript LSP tool * action: post-run-job: try clean daemon container, warn on failure
This commit is contained in:
parent
cd46bde16a
commit
21affdd5d3
22
dist/index.js
generated
vendored
22
dist/index.js
generated
vendored
@ -413,7 +413,27 @@ class NixInstallerAction {
|
||||
const container_id = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getState("docker_shim_container_id");
|
||||
if (container_id !== "") {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.startGroup("Cleaning up the Nix daemon's Docker shim");
|
||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec("docker", ["rm", "--force", container_id]);
|
||||
let cleaned = false;
|
||||
try {
|
||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec("docker", ["rm", "--force", container_id]);
|
||||
cleaned = true;
|
||||
}
|
||||
catch (_a) {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.warning("failed to cleanup nix daemon container");
|
||||
}
|
||||
if (!cleaned) {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info("trying to pkill the container's shim process");
|
||||
try {
|
||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec("pkill", [container_id]);
|
||||
cleaned = true;
|
||||
}
|
||||
catch (_b) {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.warning("failed to forcibly kill the container's shim process");
|
||||
}
|
||||
}
|
||||
if (!cleaned) {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.warning("Giving up on cleaning up the nix daemon container");
|
||||
}
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.endGroup();
|
||||
}
|
||||
}
|
||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -22,6 +22,7 @@
|
||||
packages = with pkgs; [
|
||||
nodejs_latest
|
||||
nixpkgs-fmt
|
||||
nodePackages_latest.typescript-language-server
|
||||
];
|
||||
};
|
||||
});
|
||||
|
27
src/main.ts
27
src/main.ts
@ -521,10 +521,35 @@ class NixInstallerAction {
|
||||
}
|
||||
async cleanupDockerShim(): Promise<void> {
|
||||
const container_id = actions_core.getState("docker_shim_container_id");
|
||||
|
||||
if (container_id !== "") {
|
||||
actions_core.startGroup("Cleaning up the Nix daemon's Docker shim");
|
||||
|
||||
await actions_exec.exec("docker", ["rm", "--force", container_id]);
|
||||
let cleaned = false;
|
||||
try {
|
||||
await actions_exec.exec("docker", ["rm", "--force", container_id]);
|
||||
cleaned = true;
|
||||
} catch {
|
||||
actions_core.warning("failed to cleanup nix daemon container");
|
||||
}
|
||||
|
||||
if (!cleaned) {
|
||||
actions_core.info("trying to pkill the container's shim process");
|
||||
try {
|
||||
await actions_exec.exec("pkill", [container_id]);
|
||||
cleaned = true;
|
||||
} catch {
|
||||
actions_core.warning(
|
||||
"failed to forcibly kill the container's shim process",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!cleaned) {
|
||||
actions_core.warning(
|
||||
"Giving up on cleaning up the nix daemon container",
|
||||
);
|
||||
}
|
||||
|
||||
actions_core.endGroup();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user