mirror of
https://github.com/DeterminateSystems/nix-installer-action.git
synced 2024-12-23 13:32:06 +01:00
Handle docker not existing
This commit is contained in:
parent
21affdd5d3
commit
81ee88fd4a
3 changed files with 47 additions and 33 deletions
39
dist/index.js
generated
vendored
39
dist/index.js
generated
vendored
|
@ -98,23 +98,30 @@ class NixInstallerAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.");
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.");
|
||||||
const exit_code = await _actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec("docker", ["info"], {
|
let exit_code;
|
||||||
silent: true,
|
try {
|
||||||
listeners: {
|
exit_code = await _actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec("docker", ["info"], {
|
||||||
stdout: (data) => {
|
silent: true,
|
||||||
const trimmed = data.toString("utf-8").trimEnd();
|
listeners: {
|
||||||
if (trimmed.length >= 0) {
|
stdout: (data) => {
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.debug(trimmed);
|
const trimmed = data.toString("utf-8").trimEnd();
|
||||||
}
|
if (trimmed.length >= 0) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.debug(trimmed);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stderr: (data) => {
|
||||||
|
const trimmed = data.toString("utf-8").trimEnd();
|
||||||
|
if (trimmed.length >= 0) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.debug(trimmed);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
stderr: (data) => {
|
});
|
||||||
const trimmed = data.toString("utf-8").trimEnd();
|
}
|
||||||
if (trimmed.length >= 0) {
|
catch (e) {
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.debug(trimmed);
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Docker not detected, not enabling docker shim.");
|
||||||
}
|
return;
|
||||||
},
|
}
|
||||||
},
|
|
||||||
});
|
|
||||||
if (exit_code !== 0) {
|
if (exit_code !== 0) {
|
||||||
if (this.force_docker_shim) {
|
if (this.force_docker_shim) {
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.warning("docker info check failed, but trying anyway since force-docker-shim is enabled.");
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.warning("docker info check failed, but trying anyway since force-docker-shim is enabled.");
|
||||||
|
|
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
39
src/main.ts
39
src/main.ts
|
@ -129,23 +129,30 @@ class NixInstallerAction {
|
||||||
actions_core.debug(
|
actions_core.debug(
|
||||||
"Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.",
|
"Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.",
|
||||||
);
|
);
|
||||||
const exit_code = await actions_exec.exec("docker", ["info"], {
|
|
||||||
silent: true,
|
let exit_code;
|
||||||
listeners: {
|
try {
|
||||||
stdout: (data: Buffer) => {
|
exit_code = await actions_exec.exec("docker", ["info"], {
|
||||||
const trimmed = data.toString("utf-8").trimEnd();
|
silent: true,
|
||||||
if (trimmed.length >= 0) {
|
listeners: {
|
||||||
actions_core.debug(trimmed);
|
stdout: (data: Buffer) => {
|
||||||
}
|
const trimmed = data.toString("utf-8").trimEnd();
|
||||||
|
if (trimmed.length >= 0) {
|
||||||
|
actions_core.debug(trimmed);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
const trimmed = data.toString("utf-8").trimEnd();
|
||||||
|
if (trimmed.length >= 0) {
|
||||||
|
actions_core.debug(trimmed);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
stderr: (data: Buffer) => {
|
});
|
||||||
const trimmed = data.toString("utf-8").trimEnd();
|
} catch (e) {
|
||||||
if (trimmed.length >= 0) {
|
actions_core.debug("Docker not detected, not enabling docker shim.");
|
||||||
actions_core.debug(trimmed);
|
return;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (exit_code !== 0) {
|
if (exit_code !== 0) {
|
||||||
if (this.force_docker_shim) {
|
if (this.force_docker_shim) {
|
||||||
|
|
Loading…
Reference in a new issue