.github/workflows/fetch_snaps.yaml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2024 Canonical Ltd. | |
# See LICENSE file for licensing details. | |
on: | |
workflow_dispatch: | |
jobs: | |
test-deploy-bundle: | |
name: Test deploy bundle | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Free up disk space | |
timeout-minutes: 1 | |
run: | | |
printf '\nDisk usage before cleanup\n' | |
df --human-readable | |
# Based on https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | |
rm -r /usr/share/dotnet | |
rm -r /opt/hostedtoolcache/ | |
printf '\nDisk usage after cleanup\n' | |
df --human-readable | |
- name: Set up environment | |
timeout-minutes: 60 | |
run: | | |
# `--classic` applies to juju 2 snap; ignored for juju 3 snap | |
sudo snap install juju --classic --channel='3.4/stable' | |
sudo snap refresh lxd --channel='latest/stable' | |
sudo adduser "$USER" 'lxd' | |
# `newgrp` does not work in GitHub Actions; use `sg` instead | |
sg 'lxd' -c "lxd waitready" | |
sg 'lxd' -c "lxd init --auto" | |
sg 'lxd' -c "lxc network set lxdbr0 ipv6.address none" | |
sudo iptables -F FORWARD | |
sudo iptables -P FORWARD ACCEPT | |
# shellcheck disable=SC2193 | |
# (shellcheck sees it as constant, but GitHub Actions expression is not constant between workflow runs) | |
sg 'lxd' -c "lxc image copy ubuntu:82b997ec581b local: --alias 'juju/[email protected]/amd64'" | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Deploy bundle | |
timeout-minutes: 15 | |
run: | | |
mkdir -p ~/.local/share/juju # Workaround for juju 3 strict snap | |
sg 'lxd' -c "juju bootstrap 'lxd' --config model-logs-size=10G '--agent-version=3.4.5'" | |
juju model-defaults logging-config='<root>=INFO; unit=DEBUG' | |
juju add-model test | |
# Unable to set constraint on all models because of Juju bug: | |
# https://bugs.launchpad.net/juju/+bug/2065050 | |
juju set-model-constraints arch='amd64' | |
sg 'lxd' -c "lxc image list" | |
juju deploy ./releases/latest/postgresql-bundle.yaml | |
sleep 180 | |
juju status | |
juju exec --all -- hostname -f | |
juju exec --all -- snap list |