From a83cba11db8fb346acba6a18e839ba7ed9b47056 Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Tue, 6 Aug 2024 11:30:55 +0930 Subject: [PATCH] Add support for arm64 builds for charm-local-users (#39) This ports the release.yaml changes from charm-local-users to here. :) --- .../configs/charm-local-users_main.tfvars | 8 +++++++- .../hardware-observer-operator_main.tfvars | 3 ++- .../templates/github/charm_check.yaml.tftpl | 1 + .../templates/github/charm_release.yaml.tftpl | 19 +++++++++++++------ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/terraform-plans/configs/charm-local-users_main.tfvars b/terraform-plans/configs/charm-local-users_main.tfvars index 520af68..8cfd70a 100644 --- a/terraform-plans/configs/charm-local-users_main.tfvars +++ b/terraform-plans/configs/charm-local-users_main.tfvars @@ -21,7 +21,13 @@ templates = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - branch = "main" + branch = "main", + # github hosted runners are amd64 + # Ubuntu_ARM64_4C_16G_01 is the github-hosted arm64 runner we have access to. + # We prefer the github runners because they are smaller machines and save resources. + # If we have issues with it, we can switch to the larger and more numerous self-hosted options: + # - runs-on: [self-hosted, jammy, ARM64] + runs_on = "[[ubuntu-latest], [Ubuntu_ARM64_4C_16G_01]]", } } } diff --git a/terraform-plans/configs/hardware-observer-operator_main.tfvars b/terraform-plans/configs/hardware-observer-operator_main.tfvars index e03ca3b..f020dc0 100644 --- a/terraform-plans/configs/hardware-observer-operator_main.tfvars +++ b/terraform-plans/configs/hardware-observer-operator_main.tfvars @@ -16,7 +16,8 @@ templates = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - branch = "main" + branch = "main", + runs_on = "ubuntu-latest", } } } diff --git a/terraform-plans/templates/github/charm_check.yaml.tftpl b/terraform-plans/templates/github/charm_check.yaml.tftpl index ad9b053..5d14fbd 100644 --- a/terraform-plans/templates/github/charm_check.yaml.tftpl +++ b/terraform-plans/templates/github/charm_check.yaml.tftpl @@ -64,6 +64,7 @@ jobs: with: provider: "lxd" juju-channel: $${{ matrix.juju-channel }} + charmcraft-channel: "2.x/stable" - name: Install latest tox version run: | diff --git a/terraform-plans/templates/github/charm_release.yaml.tftpl b/terraform-plans/templates/github/charm_release.yaml.tftpl index 2aea65f..9ec7195 100644 --- a/terraform-plans/templates/github/charm_release.yaml.tftpl +++ b/terraform-plans/templates/github/charm_release.yaml.tftpl @@ -18,17 +18,24 @@ jobs: release: needs: check - runs-on: ubuntu-latest + runs-on: $${{ matrix.runs-on }} + strategy: + fail-fast: false + matrix: + runs-on: ${runs_on} steps: - name: Checkout uses: actions/checkout@v4 + - name: Initialize lxd # This should dropped once it's implemented on charming-actions itself. https://github.com/canonical/charming-actions/issues/140 - uses: canonical/setup-lxd@v0.1.1 - - name: Upload charm to charmhub - uses: canonical/charming-actions/upload-charm@2.4.0 + # revision is latest main at time of writing; using because it contains a fix to https://github.com/canonical/setup-lxd/issues/19 + uses: canonical/setup-lxd@2aa6f7caf7d1484298a64192f7f63a6684e648a4 + + - name: Pack and upload to charmhub + uses: canonical/charming-actions/upload-charm@2.6.2 with: + charmcraft-channel: "2.x/stable" credentials: "$${{ secrets.CHARMHUB_TOKEN }}" github-token: "$${{ secrets.GITHUB_TOKEN }}" - channel: "latest/edge" - # Note(rgildein): Right now we are not using destructive-mode, since our charmcraft.yaml is designed with a single build-on and the ability to run-on multiple bases. Running with destructive-mode would require aligning the base defined in this job with the one defined in charmcraft.yaml (build-on). + # Ensure the charm is built in an isolated environment and on the correct base in an lxd container. destructive-mode: false