From 0d340e2757da0373a6520327a473b997efe0201d Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Fri, 1 Nov 2024 14:36:26 +0100 Subject: [PATCH] Support charmcraft 3 in openstack-exporter-operator (#109) Co-authored-by: Robert Gildein --- .github/workflows/terraform-apply.yaml | 2 ++ terraform-plans/configs/charm-advanced-routing_main.tfvars | 7 +++++-- terraform-plans/configs/charm-apt-mirror_main.tfvars | 7 +++++-- terraform-plans/configs/charm-juju-backup-all_main.tfvars | 7 +++++-- terraform-plans/configs/charm-juju-local_main.tfvars | 7 +++++-- terraform-plans/configs/charm-local-users_main.tfvars | 7 +++++-- terraform-plans/configs/charm-logrotated_main.tfvars | 7 +++++-- terraform-plans/configs/charm-nginx_main.tfvars | 7 +++++-- terraform-plans/configs/charm-nrpe_main.tfvars | 7 +++++-- .../configs/charm-openstack-service-checks_main.tfvars | 7 +++++-- .../configs/charm-prometheus-libvirt-exporter_main.tfvars | 7 +++++-- terraform-plans/configs/charm-sysconfig_main.tfvars | 7 +++++-- terraform-plans/configs/charm-userdir-ldap_main.tfvars | 7 +++++-- .../configs/hardware-observer-operator_main.tfvars | 7 +++++-- .../configs/openstack-exporter-operator_main.tfvars | 7 +++++-- terraform-plans/templates/github/charm_promote.yaml.tftpl | 2 +- terraform-plans/templates/github/charm_release.yaml.tftpl | 2 +- 17 files changed, 74 insertions(+), 30 deletions(-) diff --git a/.github/workflows/terraform-apply.yaml b/.github/workflows/terraform-apply.yaml index b8472e7..af7e03f 100644 --- a/.github/workflows/terraform-apply.yaml +++ b/.github/workflows/terraform-apply.yaml @@ -26,6 +26,8 @@ jobs: - name: Install Terraform run: sudo snap install terraform --classic + # To format the repository to pass this lint: + # $ cd terraform-plans && terraform fmt -recursive - name: Terraform format lint working-directory: ./terraform-plans run: terraform fmt -check -recursive -diff diff --git a/terraform-plans/configs/charm-advanced-routing_main.tfvars b/terraform-plans/configs/charm-advanced-routing_main.tfvars index e5ed0eb..ef266f1 100644 --- a/terraform-plans/configs/charm-advanced-routing_main.tfvars +++ b/terraform-plans/configs/charm-advanced-routing_main.tfvars @@ -23,13 +23,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-apt-mirror_main.tfvars b/terraform-plans/configs/charm-apt-mirror_main.tfvars index ae15574..5ba470f 100644 --- a/terraform-plans/configs/charm-apt-mirror_main.tfvars +++ b/terraform-plans/configs/charm-apt-mirror_main.tfvars @@ -23,13 +23,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-juju-backup-all_main.tfvars b/terraform-plans/configs/charm-juju-backup-all_main.tfvars index c9e3077..e0c4a86 100644 --- a/terraform-plans/configs/charm-juju-backup-all_main.tfvars +++ b/terraform-plans/configs/charm-juju-backup-all_main.tfvars @@ -23,13 +23,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-juju-local_main.tfvars b/terraform-plans/configs/charm-juju-local_main.tfvars index 3255296..0647e39 100644 --- a/terraform-plans/configs/charm-juju-local_main.tfvars +++ b/terraform-plans/configs/charm-juju-local_main.tfvars @@ -23,13 +23,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-local-users_main.tfvars b/terraform-plans/configs/charm-local-users_main.tfvars index 96956bf..0fa3217 100644 --- a/terraform-plans/configs/charm-local-users_main.tfvars +++ b/terraform-plans/configs/charm-local-users_main.tfvars @@ -28,7 +28,9 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" @@ -37,7 +39,8 @@ templates = { # 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. - runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-logrotated_main.tfvars b/terraform-plans/configs/charm-logrotated_main.tfvars index 770add7..a1fa5d3 100644 --- a/terraform-plans/configs/charm-logrotated_main.tfvars +++ b/terraform-plans/configs/charm-logrotated_main.tfvars @@ -23,13 +23,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-nginx_main.tfvars b/terraform-plans/configs/charm-nginx_main.tfvars index b806a57..29c85ba 100644 --- a/terraform-plans/configs/charm-nginx_main.tfvars +++ b/terraform-plans/configs/charm-nginx_main.tfvars @@ -23,13 +23,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-nrpe_main.tfvars b/terraform-plans/configs/charm-nrpe_main.tfvars index ce6da13..9d69bb3 100644 --- a/terraform-plans/configs/charm-nrpe_main.tfvars +++ b/terraform-plans/configs/charm-nrpe_main.tfvars @@ -28,13 +28,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-openstack-service-checks_main.tfvars b/terraform-plans/configs/charm-openstack-service-checks_main.tfvars index 47c64fa..a4bcced 100644 --- a/terraform-plans/configs/charm-openstack-service-checks_main.tfvars +++ b/terraform-plans/configs/charm-openstack-service-checks_main.tfvars @@ -15,13 +15,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars b/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars index 9b9666a..de94761 100644 --- a/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars +++ b/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars @@ -28,7 +28,9 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" @@ -37,7 +39,8 @@ templates = { # 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. - runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + charmcraft_channel = "2.x/stable", } jira_sync_config = { source = "./templates/github/jira_sync_config.yaml.tftpl" diff --git a/terraform-plans/configs/charm-sysconfig_main.tfvars b/terraform-plans/configs/charm-sysconfig_main.tfvars index 771cbe3..276f54b 100644 --- a/terraform-plans/configs/charm-sysconfig_main.tfvars +++ b/terraform-plans/configs/charm-sysconfig_main.tfvars @@ -25,13 +25,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/charm-userdir-ldap_main.tfvars b/terraform-plans/configs/charm-userdir-ldap_main.tfvars index 6fb5ce3..f101b00 100644 --- a/terraform-plans/configs/charm-userdir-ldap_main.tfvars +++ b/terraform-plans/configs/charm-userdir-ldap_main.tfvars @@ -28,13 +28,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/hardware-observer-operator_main.tfvars b/terraform-plans/configs/hardware-observer-operator_main.tfvars index c8ef185..0d5d288 100644 --- a/terraform-plans/configs/hardware-observer-operator_main.tfvars +++ b/terraform-plans/configs/hardware-observer-operator_main.tfvars @@ -23,13 +23,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "2.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", + charmcraft_channel = "2.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/configs/openstack-exporter-operator_main.tfvars b/terraform-plans/configs/openstack-exporter-operator_main.tfvars index c06c231..2254e7c 100644 --- a/terraform-plans/configs/openstack-exporter-operator_main.tfvars +++ b/terraform-plans/configs/openstack-exporter-operator_main.tfvars @@ -16,13 +16,16 @@ templates = { promote = { source = "./templates/github/charm_promote.yaml.tftpl" destination = ".github/workflows/promote.yaml" - vars = {} + vars = { + charmcraft_channel = "3.x/stable", + } } release = { source = "./templates/github/charm_release.yaml.tftpl" destination = ".github/workflows/release.yaml" vars = { - runs_on = "[[ubuntu-22.04]]", + runs_on = "[[ubuntu-22.04]]", + charmcraft_channel = "3.x/stable", } } jira_sync_config = { diff --git a/terraform-plans/templates/github/charm_promote.yaml.tftpl b/terraform-plans/templates/github/charm_promote.yaml.tftpl index e2502fe..564a343 100644 --- a/terraform-plans/templates/github/charm_promote.yaml.tftpl +++ b/terraform-plans/templates/github/charm_promote.yaml.tftpl @@ -37,4 +37,4 @@ jobs: github-token: $${{ secrets.GITHUB_TOKEN }} destination-channel: $${{ steps.set-channels.outputs.destination-channel }} origin-channel: $${{ steps.set-channels.outputs.origin-channel }} - charmcraft-channel: "2.x/stable" + charmcraft-channel: "${charmcraft_channel}" diff --git a/terraform-plans/templates/github/charm_release.yaml.tftpl b/terraform-plans/templates/github/charm_release.yaml.tftpl index 6194f3c..b9172b1 100644 --- a/terraform-plans/templates/github/charm_release.yaml.tftpl +++ b/terraform-plans/templates/github/charm_release.yaml.tftpl @@ -36,7 +36,7 @@ jobs: - name: Pack and upload to charmhub uses: canonical/charming-actions/upload-charm@2.6.2 with: - charmcraft-channel: "2.x/stable" + charmcraft-channel: "${charmcraft_channel}" credentials: "$${{ secrets.CHARMHUB_TOKEN }}" github-token: "$${{ secrets.GITHUB_TOKEN }}" # Ensure the charm is built in an isolated environment and on the correct base in an lxd container.