From ccfc6e771a4238cbf06fced67d55d29ab3fc2c74 Mon Sep 17 00:00:00 2001 From: Maksim Beliaev Date: Thu, 13 Apr 2023 11:32:30 +0200 Subject: [PATCH 1/4] added timeout --- dist/bootstrap/index.js | 2 +- src/bootstrap/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/bootstrap/index.js b/dist/bootstrap/index.js index 4700ac3..2a67b1e 100644 --- a/dist/bootstrap/index.js +++ b/dist/bootstrap/index.js @@ -5509,7 +5509,7 @@ function microk8s_init(addons) { return __awaiter(this, void 0, void 0, function* () { // microk8s needs some additional things done to ensure it's ready for Juju. // Add the given addons if any were given. - yield exec_as_microk8s("microk8s status --wait-ready"); + yield exec_as_microk8s("microk8s status --wait-ready --timeout 900"); if (addons) { yield exec_as_microk8s("sudo microk8s enable " + addons); } diff --git a/src/bootstrap/index.ts b/src/bootstrap/index.ts index d24536f..f366d53 100644 --- a/src/bootstrap/index.ts +++ b/src/bootstrap/index.ts @@ -74,7 +74,7 @@ async function retry_until_rc(cmd: string, expected_rc=0, maxRetries=12, timeout async function microk8s_init(addons) { // microk8s needs some additional things done to ensure it's ready for Juju. // Add the given addons if any were given. - await exec_as_microk8s("microk8s status --wait-ready"); + await exec_as_microk8s("microk8s status --wait-ready --timeout 900"); if (addons) { await exec_as_microk8s("sudo microk8s enable " + addons); } From 03007445e7e986912a0829df77b83dbfb211f0a4 Mon Sep 17 00:00:00 2001 From: Maksim Beliaev Date: Wed, 19 Apr 2023 15:19:30 +0200 Subject: [PATCH 2/4] Update src/bootstrap/index.ts Co-authored-by: Adam Dyess --- src/bootstrap/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/index.ts b/src/bootstrap/index.ts index f366d53..0a18fe7 100644 --- a/src/bootstrap/index.ts +++ b/src/bootstrap/index.ts @@ -74,7 +74,10 @@ async function retry_until_rc(cmd: string, expected_rc=0, maxRetries=12, timeout async function microk8s_init(addons) { // microk8s needs some additional things done to ensure it's ready for Juju. // Add the given addons if any were given. - await exec_as_microk8s("microk8s status --wait-ready --timeout 900"); + if (! await exec_as_microk8s("microk8s status --wait-ready --timeout 900")){ + core.setFailed("Timed out waiting for microk8s to be ready") + return false; + } if (addons) { await exec_as_microk8s("sudo microk8s enable " + addons); } From a066042478cbe617bf0ba0dbb4a470b547edede0 Mon Sep 17 00:00:00 2001 From: Maksim Beliaev Date: Wed, 19 Apr 2023 15:20:49 +0200 Subject: [PATCH 3/4] build --- dist/bootstrap/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/bootstrap/index.js b/dist/bootstrap/index.js index 2a67b1e..98a5944 100644 --- a/dist/bootstrap/index.js +++ b/dist/bootstrap/index.js @@ -5509,7 +5509,10 @@ function microk8s_init(addons) { return __awaiter(this, void 0, void 0, function* () { // microk8s needs some additional things done to ensure it's ready for Juju. // Add the given addons if any were given. - yield exec_as_microk8s("microk8s status --wait-ready --timeout 900"); + if (!(yield exec_as_microk8s("microk8s status --wait-ready --timeout 900"))) { + core.setFailed("Timed out waiting for microk8s to be ready"); + return false; + } if (addons) { yield exec_as_microk8s("sudo microk8s enable " + addons); } @@ -5829,4 +5832,4 @@ module.exports = require("util");; /******/ // Load entry module and return exports /******/ return __nccwpck_require__(1098); /******/ })() -; +; \ No newline at end of file From 1c0a004d15c6a257b59ff4e64aab4ae4d337871d Mon Sep 17 00:00:00 2001 From: Maksim Beliaev Date: Wed, 19 Apr 2023 16:36:09 +0200 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Adam Dyess --- dist/bootstrap/index.js | 2 +- src/bootstrap/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/bootstrap/index.js b/dist/bootstrap/index.js index 98a5944..3be14de 100644 --- a/dist/bootstrap/index.js +++ b/dist/bootstrap/index.js @@ -5510,7 +5510,7 @@ function microk8s_init(addons) { // microk8s needs some additional things done to ensure it's ready for Juju. // Add the given addons if any were given. if (!(yield exec_as_microk8s("microk8s status --wait-ready --timeout 900"))) { - core.setFailed("Timed out waiting for microk8s to be ready"); + core.setFailed("microk8s couldn't become ready"); return false; } if (addons) { diff --git a/src/bootstrap/index.ts b/src/bootstrap/index.ts index 0a18fe7..0bea321 100644 --- a/src/bootstrap/index.ts +++ b/src/bootstrap/index.ts @@ -75,7 +75,7 @@ async function microk8s_init(addons) { // microk8s needs some additional things done to ensure it's ready for Juju. // Add the given addons if any were given. if (! await exec_as_microk8s("microk8s status --wait-ready --timeout 900")){ - core.setFailed("Timed out waiting for microk8s to be ready") + core.setFailed("microk8s couldn't become ready") return false; } if (addons) {