Merge pull request #66 from DeterminateSystems/hoverbear/fh-160-action-should-work-under-nektosact-in-the-absence-of-systemd

Handle docker not existing.
This commit is contained in:
Ana Hobden 2024-01-10 08:36:26 -08:00 committed by GitHub
commit ffea801f30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 33 deletions

9
dist/index.js generated vendored
View file

@ -98,7 +98,9 @@ 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;
try {
exit_code = await _actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec("docker", ["info"], {
silent: true, silent: true,
listeners: { listeners: {
stdout: (data) => { stdout: (data) => {
@ -115,6 +117,11 @@ class NixInstallerAction {
}, },
}, },
}); });
}
catch (e) {
_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

File diff suppressed because one or more lines are too long

View file

@ -129,7 +129,10 @@ 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"], {
let exit_code;
try {
exit_code = await actions_exec.exec("docker", ["info"], {
silent: true, silent: true,
listeners: { listeners: {
stdout: (data: Buffer) => { stdout: (data: Buffer) => {
@ -146,6 +149,10 @@ class NixInstallerAction {
}, },
}, },
}); });
} catch (e) {
actions_core.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) {