diff --git a/action.yaml b/action.yaml index f1b6dd8..6f8ab2c 100644 --- a/action.yaml +++ b/action.yaml @@ -44,6 +44,10 @@ inputs: description: "snap channel for juju bundle, installed via snap" required: false default: "latest/stable" + juju-classic-confinement: + description: "Install juju with classic confinement" + required: false + default: "true" lxd-channel: description: "snap channel for lxd regardless of provider, installed via snap" required: false @@ -60,6 +64,10 @@ inputs: description: "microk8s addons to enable" required: false default: "storage dns rbac" + microk8s-classic-confinement: + description: "Install microk8s with classic confinement" + required: false + default: "true" runs: using: "node16" main: "dist/bootstrap/index.js" diff --git a/dist/bootstrap/index.js b/dist/bootstrap/index.js index 4700ac3..92d700a 100644 --- a/dist/bootstrap/index.js +++ b/dist/bootstrap/index.js @@ -5579,8 +5579,10 @@ function run() { const juju_channel = core.getInput("juju-channel"); const juju_bundle_channel = core.getInput("juju-bundle-channel"); const juju_crashdump_channel = core.getInput("juju-crashdump-channel"); + const juju_classic_confinement = core.getInput("juju-classic-confinement") == "true" ? "--classic" : ""; const lxd_channel = core.getInput("lxd-channel"); const microk8s_group = get_microk8s_group(); + const microk8s_classic_confinement = core.getInput("microk8s-classic-confinement") == "true" ? "--classic" : ""; let bootstrap_constraints = core.getInput("bootstrap-constraints"); const microk8s_addons = core.getInput("microk8s-addons"); let group = ""; @@ -5613,7 +5615,7 @@ function run() { yield exec.exec("sudo --preserve-env=http_proxy,https_proxy,no_proxy pip3 install tox"); core.endGroup(); core.startGroup("Install Juju"); - yield snap(`install juju --classic --channel=${juju_channel}`); + yield snap(`install juju ${juju_classic_confinement} --channel=${juju_channel}`); core.endGroup(); core.startGroup("Install tools"); yield snap("install jq"); @@ -5642,10 +5644,10 @@ function run() { else if (provider === "microk8s") { core.startGroup("Install microk8s"); if ([null, ""].includes(channel) == false) { - yield snap(`install microk8s --classic --channel=${channel}`); + yield snap(`install microk8s ${microk8s_classic_confinement} --channel=${channel}`); } else { - yield snap("install microk8s --classic"); + yield snap(`install microk8s ${microk8s_classic_confinement}`); } core.endGroup(); core.startGroup("Initialize microk8s"); @@ -5829,4 +5831,4 @@ module.exports = require("util");; /******/ // Load entry module and return exports /******/ return __nccwpck_require__(1098); /******/ })() -; +; \ No newline at end of file diff --git a/src/bootstrap/index.ts b/src/bootstrap/index.ts index d24536f..d9d7dd1 100644 --- a/src/bootstrap/index.ts +++ b/src/bootstrap/index.ts @@ -147,8 +147,10 @@ async function run() { const juju_channel = core.getInput("juju-channel"); const juju_bundle_channel = core.getInput("juju-bundle-channel"); const juju_crashdump_channel = core.getInput("juju-crashdump-channel") + const juju_classic_confinement = core.getInput("juju-classic-confinement") == "true" ? "--classic" : ""; const lxd_channel = core.getInput("lxd-channel"); const microk8s_group = get_microk8s_group(); + const microk8s_classic_confinement = core.getInput("microk8s-classic-confinement") == "true" ? "--classic" : ""; let bootstrap_constraints = core.getInput("bootstrap-constraints"); const microk8s_addons = core.getInput("microk8s-addons") let group = ""; @@ -181,7 +183,7 @@ async function run() { await exec.exec("sudo --preserve-env=http_proxy,https_proxy,no_proxy pip3 install tox"); core.endGroup(); core.startGroup("Install Juju"); - await snap(`install juju --classic --channel=${juju_channel}`); + await snap(`install juju ${juju_classic_confinement} --channel=${juju_channel}`); core.endGroup(); core.startGroup("Install tools"); await snap("install jq"); @@ -204,21 +206,21 @@ async function run() { await exec.exec("mkdir", ["-p", juju_dir]); let bootstrap_command = `juju bootstrap --debug --verbose ${provider} ${bootstrap_options}` if (provider === "lxd") { - if ([null, ""].includes(channel) == false){ + if ([null, ""].includes(channel) == false) { await snap(`refresh lxd --channel=${channel}`); - } + } group = "lxd"; } else if (provider === "microk8s") { core.startGroup("Install microk8s"); - if ([null, ""].includes(channel) == false){ - await snap(`install microk8s --classic --channel=${channel}`); + if ([null, ""].includes(channel) == false) { + await snap(`install microk8s ${microk8s_classic_confinement} --channel=${channel}`); } else { - await snap("install microk8s --classic"); + await snap(`install microk8s ${microk8s_classic_confinement}`); } core.endGroup(); core.startGroup("Initialize microk8s"); await exec.exec('bash', ['-c', `sudo usermod -a -G ${microk8s_group} $USER`]); - if(!await microk8s_init(microk8s_addons)) { + if (!await microk8s_init(microk8s_addons)) { return; } group = microk8s_group;