From 103f0e22f568b5fa5e92a25f2323b97a794001c6 Mon Sep 17 00:00:00 2001 From: Robert Gildein Date: Thu, 31 Oct 2024 14:44:35 +0100 Subject: [PATCH] Add more project to the automation I need to add juju_channels to the configuration and use it in charm_check template. Add TEST_CHARM env variable to snap_check template. Added the check, promote and release for: - charm-duplicty - charm-promethues-blackbox-exporter - charm-prometheus-juju-exporter - charm-storage-connector - prometheus-backupall-juju-exporter - prometheus-juju-exporter related: #111 Signed-off-by: Robert Gildein --- .../charm-advanced-routing_main.tfvars | 1 + .../configs/charm-apt-mirror_main.tfvars | 1 + .../configs/charm-duplicity_main.tfvars | 21 ++++++++++++++++++ .../configs/charm-juju-backup-all_main.tfvars | 1 + .../configs/charm-juju-local_main.tfvars | 1 + .../configs/charm-local-users_main.tfvars | 1 + .../configs/charm-logrotated_main.tfvars | 1 + .../configs/charm-nginx_main.tfvars | 1 + .../configs/charm-nrpe_main.tfvars | 1 + ...m-prometheus-blackbox-exporter_main.tfvars | 21 ++++++++++++++++++ ...charm-prometheus-juju-exporter_main.tfvars | 21 ++++++++++++++++++ ...rm-prometheus-libvirt-exporter_main.tfvars | 1 + .../charm-storage-connector_main.tfvars | 21 ++++++++++++++++++ .../configs/charm-sysconfig_main.tfvars | 1 + .../configs/charm-userdir-ldap_main.tfvars | 1 + .../hardware-observer-operator_main.tfvars | 1 + ...theus-juju-backup-all-exporter_main.tfvars | 19 ++++++++++++++++ .../prometheus-juju-exporter_main.tfvars | 19 ++++++++++++++++ .../templates/github/charm_check.yaml.tftpl | 4 ++-- .../templates/github/snap_check.yaml.tftpl | 22 ++++++++++++------- 20 files changed, 150 insertions(+), 10 deletions(-) diff --git a/terraform-plans/configs/charm-advanced-routing_main.tfvars b/terraform-plans/configs/charm-advanced-routing_main.tfvars index e5ed0eb..649a7f6 100644 --- a/terraform-plans/configs/charm-advanced-routing_main.tfvars +++ b/terraform-plans/configs/charm-advanced-routing_main.tfvars @@ -18,6 +18,7 @@ templates = { vars = { runs_on = "[[ubuntu-22.04]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-apt-mirror_main.tfvars b/terraform-plans/configs/charm-apt-mirror_main.tfvars index ae15574..802334f 100644 --- a/terraform-plans/configs/charm-apt-mirror_main.tfvars +++ b/terraform-plans/configs/charm-apt-mirror_main.tfvars @@ -18,6 +18,7 @@ templates = { vars = { runs_on = "[[ubuntu-22.04]]", test_commands = "['tox -e func -- -v --series focal', 'tox -e func -- -v --series jammy']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-duplicity_main.tfvars b/terraform-plans/configs/charm-duplicity_main.tfvars index 7089cb8..d10e134 100644 --- a/terraform-plans/configs/charm-duplicity_main.tfvars +++ b/terraform-plans/configs/charm-duplicity_main.tfvars @@ -12,6 +12,27 @@ templates = { destination = ".github/CODEOWNERS" vars = {} } + check = { + source = "./templates/github/charm_check.yaml.tftpl" + destination = ".github/workflows/check.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + test_commands = "['TEST_JUJU3=1 make functional']", + juju_channels = "[\"3.4/stable\"]", + } + } + promote = { + source = "./templates/github/charm_promote.yaml.tftpl" + destination = ".github/workflows/promote.yaml" + vars = {} + } + release = { + source = "./templates/github/charm_release.yaml.tftpl" + destination = ".github/workflows/release.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } jira_sync_config = { source = "./templates/github/jira_sync_config.yaml.tftpl" destination = ".github/.jira_sync_config.yaml" diff --git a/terraform-plans/configs/charm-juju-backup-all_main.tfvars b/terraform-plans/configs/charm-juju-backup-all_main.tfvars index c9e3077..6190b80 100644 --- a/terraform-plans/configs/charm-juju-backup-all_main.tfvars +++ b/terraform-plans/configs/charm-juju-backup-all_main.tfvars @@ -18,6 +18,7 @@ templates = { vars = { runs_on = "[[self-hosted, linux, x64, large, jammy]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-juju-local_main.tfvars b/terraform-plans/configs/charm-juju-local_main.tfvars index 3255296..6f0ba85 100644 --- a/terraform-plans/configs/charm-juju-local_main.tfvars +++ b/terraform-plans/configs/charm-juju-local_main.tfvars @@ -18,6 +18,7 @@ templates = { vars = { runs_on = "[[ubuntu-22.04]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-local-users_main.tfvars b/terraform-plans/configs/charm-local-users_main.tfvars index 96956bf..8b4907f 100644 --- a/terraform-plans/configs/charm-local-users_main.tfvars +++ b/terraform-plans/configs/charm-local-users_main.tfvars @@ -23,6 +23,7 @@ templates = { # - runs-on: [self-hosted, jammy, ARM64] runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-logrotated_main.tfvars b/terraform-plans/configs/charm-logrotated_main.tfvars index 770add7..bec448e 100644 --- a/terraform-plans/configs/charm-logrotated_main.tfvars +++ b/terraform-plans/configs/charm-logrotated_main.tfvars @@ -18,6 +18,7 @@ templates = { vars = { runs_on = "[[ubuntu-22.04]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-nginx_main.tfvars b/terraform-plans/configs/charm-nginx_main.tfvars index b806a57..3d9436c 100644 --- a/terraform-plans/configs/charm-nginx_main.tfvars +++ b/terraform-plans/configs/charm-nginx_main.tfvars @@ -18,6 +18,7 @@ templates = { vars = { runs_on = "[[ubuntu-22.04]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-nrpe_main.tfvars b/terraform-plans/configs/charm-nrpe_main.tfvars index ce6da13..ff7ad31 100644 --- a/terraform-plans/configs/charm-nrpe_main.tfvars +++ b/terraform-plans/configs/charm-nrpe_main.tfvars @@ -23,6 +23,7 @@ templates = { # - runs-on: [self-hosted, jammy, ARM64] runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-prometheus-blackbox-exporter_main.tfvars b/terraform-plans/configs/charm-prometheus-blackbox-exporter_main.tfvars index bab7e7a..723fc62 100644 --- a/terraform-plans/configs/charm-prometheus-blackbox-exporter_main.tfvars +++ b/terraform-plans/configs/charm-prometheus-blackbox-exporter_main.tfvars @@ -12,6 +12,27 @@ templates = { destination = ".github/CODEOWNERS" vars = {} } + check = { + source = "./templates/github/charm_check.yaml.tftpl" + destination = ".github/workflows/check.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + test_commands = "['TEST_JUJU3=1 make functional']", + juju_channels = "[\"3.4/stable\"]", + } + } + promote = { + source = "./templates/github/charm_promote.yaml.tftpl" + destination = ".github/workflows/promote.yaml" + vars = {} + } + release = { + source = "./templates/github/charm_release.yaml.tftpl" + destination = ".github/workflows/release.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } jira_sync_config = { source = "./templates/github/jira_sync_config.yaml.tftpl" destination = ".github/.jira_sync_config.yaml" diff --git a/terraform-plans/configs/charm-prometheus-juju-exporter_main.tfvars b/terraform-plans/configs/charm-prometheus-juju-exporter_main.tfvars index 89b9866..bc91b92 100644 --- a/terraform-plans/configs/charm-prometheus-juju-exporter_main.tfvars +++ b/terraform-plans/configs/charm-prometheus-juju-exporter_main.tfvars @@ -12,6 +12,27 @@ templates = { destination = ".github/CODEOWNERS" vars = {} } + check = { + source = "./templates/github/charm_check.yaml.tftpl" + destination = ".github/workflows/check.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + test_commands = "['TEST_JUJU3=1 make functional']", + juju_channels = "['3.4/stable', '3.5/stable']]", + } + } + promote = { + source = "./templates/github/charm_promote.yaml.tftpl" + destination = ".github/workflows/promote.yaml" + vars = {} + } + release = { + source = "./templates/github/charm_release.yaml.tftpl" + destination = ".github/workflows/release.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } jira_sync_config = { source = "./templates/github/jira_sync_config.yaml.tftpl" destination = ".github/.jira_sync_config.yaml" diff --git a/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars b/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars index 9b9666a..86e3878 100644 --- a/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars +++ b/terraform-plans/configs/charm-prometheus-libvirt-exporter_main.tfvars @@ -23,6 +23,7 @@ templates = { # - runs-on: [self-hosted, jammy, ARM64] runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-storage-connector_main.tfvars b/terraform-plans/configs/charm-storage-connector_main.tfvars index 1b61b5e..47ca338 100644 --- a/terraform-plans/configs/charm-storage-connector_main.tfvars +++ b/terraform-plans/configs/charm-storage-connector_main.tfvars @@ -12,6 +12,27 @@ templates = { destination = ".github/CODEOWNERS" vars = {} } + check = { + source = "./templates/github/charm_check.yaml.tftpl" + destination = ".github/workflows/check.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + test_commands = "['FUNC_ARGS=\"--series focal\" make functional', 'FUNC_ARGS=\"--series jammy\" make functional']", + juju_channels = "[\"3.4/stable\"]", + } + } + promote = { + source = "./templates/github/charm_promote.yaml.tftpl" + destination = ".github/workflows/promote.yaml" + vars = {} + } + release = { + source = "./templates/github/charm_release.yaml.tftpl" + destination = ".github/workflows/release.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } jira_sync_config = { source = "./templates/github/jira_sync_config.yaml.tftpl" destination = ".github/.jira_sync_config.yaml" diff --git a/terraform-plans/configs/charm-sysconfig_main.tfvars b/terraform-plans/configs/charm-sysconfig_main.tfvars index 771cbe3..cac3df5 100644 --- a/terraform-plans/configs/charm-sysconfig_main.tfvars +++ b/terraform-plans/configs/charm-sysconfig_main.tfvars @@ -20,6 +20,7 @@ templates = { # on arm64 right now. runs_on = "[[self-hosted, jammy, X64, large]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/charm-userdir-ldap_main.tfvars b/terraform-plans/configs/charm-userdir-ldap_main.tfvars index 6fb5ce3..8b2eb76 100644 --- a/terraform-plans/configs/charm-userdir-ldap_main.tfvars +++ b/terraform-plans/configs/charm-userdir-ldap_main.tfvars @@ -23,6 +23,7 @@ templates = { # - runs-on: [self-hosted, jammy, ARM64] runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", test_commands = "['tox -e func']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/hardware-observer-operator_main.tfvars b/terraform-plans/configs/hardware-observer-operator_main.tfvars index c8ef185..fe7e08c 100644 --- a/terraform-plans/configs/hardware-observer-operator_main.tfvars +++ b/terraform-plans/configs/hardware-observer-operator_main.tfvars @@ -18,6 +18,7 @@ templates = { vars = { runs_on = "[[ubuntu-22.04], [Ubuntu_ARM64_4C_16G_01]]", test_commands = "['tox -e func -- -v --series focal --keep-models', 'tox -e func -- -v --series jammy --keep-models']", + juju_channels = "[\"3.4/stable\"]", } } promote = { diff --git a/terraform-plans/configs/prometheus-juju-backup-all-exporter_main.tfvars b/terraform-plans/configs/prometheus-juju-backup-all-exporter_main.tfvars index cbb102e..22f110c 100644 --- a/terraform-plans/configs/prometheus-juju-backup-all-exporter_main.tfvars +++ b/terraform-plans/configs/prometheus-juju-backup-all-exporter_main.tfvars @@ -12,6 +12,25 @@ templates = { destination = ".github/CODEOWNERS" vars = {} } + check = { + source = "./templates/github/snap_check.yaml.tftpl" + destination = ".github/workflows/check.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } + promote = { + source = "./templates/github/snap_promote.yaml.tftpl" + destination = ".github/workflows/promote.yaml" + vars = {} + } + release = { + source = "./templates/github/snap_release.yaml.tftpl" + destination = ".github/workflows/release.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } jira_sync_config = { source = "./templates/github/jira_sync_config.yaml.tftpl" destination = ".github/.jira_sync_config.yaml" diff --git a/terraform-plans/configs/prometheus-juju-exporter_main.tfvars b/terraform-plans/configs/prometheus-juju-exporter_main.tfvars index 13be31d..d870beb 100644 --- a/terraform-plans/configs/prometheus-juju-exporter_main.tfvars +++ b/terraform-plans/configs/prometheus-juju-exporter_main.tfvars @@ -12,6 +12,25 @@ templates = { destination = ".github/CODEOWNERS" vars = {} } + check = { + source = "./templates/github/snap_check.yaml.tftpl" + destination = ".github/workflows/check.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } + promote = { + source = "./templates/github/snap_promote.yaml.tftpl" + destination = ".github/workflows/promote.yaml" + vars = {} + } + release = { + source = "./templates/github/snap_release.yaml.tftpl" + destination = ".github/workflows/release.yaml" + vars = { + runs_on = "[[ubuntu-22.04]]", + } + } jira_sync_config = { source = "./templates/github/jira_sync_config.yaml.tftpl" destination = ".github/.jira_sync_config.yaml" diff --git a/terraform-plans/templates/github/charm_check.yaml.tftpl b/terraform-plans/templates/github/charm_check.yaml.tftpl index 4441eba..ea1098e 100644 --- a/terraform-plans/templates/github/charm_check.yaml.tftpl +++ b/terraform-plans/templates/github/charm_check.yaml.tftpl @@ -83,8 +83,8 @@ jobs: fail-fast: false matrix: runs-on: ${runs_on} - test-command: ${test_commands} - juju-channel: ["3.4/stable"] + test-command: ${ test_commands } + juju-channel: ${ juju_channels } steps: - uses: actions/checkout@v4 diff --git a/terraform-plans/templates/github/snap_check.yaml.tftpl b/terraform-plans/templates/github/snap_check.yaml.tftpl index 094d634..fda8096 100644 --- a/terraform-plans/templates/github/snap_check.yaml.tftpl +++ b/terraform-plans/templates/github/snap_check.yaml.tftpl @@ -87,14 +87,6 @@ jobs: with: fetch-depth: 0 # Complete git history is required to generate the version from git tags. - - name: Determine system architecture - run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV - - - name: Download the built snap - uses: actions/download-artifact@v4 - with: - name: snap_$${{ env.SYSTEM_ARCH }} - - name: Set up Python 3.10 uses: actions/setup-python@v5 with: @@ -105,5 +97,19 @@ jobs: python -m pip install --upgrade pip python -m pip install 'tox<5' + - name: Determine system architecture + run: echo "SYSTEM_ARCH=$$(uname -m)" >> $GITHUB_ENV + + - name: Download snap file artifact + uses: actions/download-artifact@v4 + with: + name: snap_$${{ env.SYSTEM_ARCH }} + + - name: Run func tests + run: | + export TEST_SNAP="$$(pwd)/$(ls | grep '.*_.*\.snap$$')" + echo "$TEST_SNAP" + tox -e func + - name: Run functional tests run: tox -e func