Skip to content

Commit

Permalink
snap install juju without classic on versions above 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Dec 12, 2023
1 parent c8d87c9 commit 4dbfa1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ jobs:
if : ${{ fromJSON(matrix.juju) > 3 }}
run: |
tox -e tests -- -k "not k8s"
juju status
exit $?
- name: Run 2.9 Tests
if : ${{ fromJSON(matrix.juju) < 3 }}
run: |
tox -e 2.9-tests -- -k "not k8s"
juju status
exit $?
test-microk8s-strict:
Expand Down
11 changes: 10 additions & 1 deletion dist/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5563,6 +5563,15 @@ const _retryable_exec = (command, initial = 10, maxTry = 5) => {
};
const snap = _retryable_exec("snap");
const apt_get = _retryable_exec("apt-get");
function snap_install(name, channel = "", classic = true) {
return __awaiter(this, void 0, void 0, function* () {
var args = new Array("install", name, `--channel=${channel}`);
if (classic) {
args.push("--classic");
}
yield snap(args.join(" "));
});
}
function run() {
return __awaiter(this, void 0, void 0, function* () {
const HOME = process.env["HOME"];
Expand Down Expand Up @@ -5613,7 +5622,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_channel, juju_channel.includes("2.9"));
core.endGroup();
core.startGroup("Install tools");
yield snap("install jq");
Expand Down
8 changes: 6 additions & 2 deletions src/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ const _retryable_exec = (command: string, initial: number = 10, maxTry: number =
const snap = _retryable_exec("snap");
const apt_get = _retryable_exec("apt-get");


async function snap_install(name: string, channel: string="", classic: boolean=true) {
var args = new Array<string>("install", name, `--channel=${channel}`);
if (classic) {args.push("--classic")}
await snap(args.join(" "))
}

async function run() {
const HOME = process.env["HOME"]
Expand Down Expand Up @@ -181,7 +185,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_channel, juju_channel.includes("2.9"));
core.endGroup();
core.startGroup("Install tools");
await snap("install jq");
Expand Down

0 comments on commit 4dbfa1c

Please sign in to comment.