sunbeam-charms/roles/charm-build/tasks/main.yaml
Guillaume Boutry 0bda4738e3
[tests] migrate tests to k8s
Migrate tests from microk8s to ck8s.
Bootstrap a controller on a manual cloud, and add ck8s to available
clouds.

Upgrade juju to 3.5

Configure ephemeral device when available, configure k8s to use it for
local storage.

Change-Id: Ief491f8b339307f0c43d11639336b02d9f6479b4
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-09-18 12:31:05 +02:00

81 lines
1.8 KiB
YAML

- name: lxd apt packages are not present
apt:
name:
- lxd
- lxd-client
state: absent
purge: true
become: true
- name: snapd is installed
apt:
name: snapd
become: true
- name: nftables is installed
apt:
name: nftables
become: true
when: ansible_distribution_release in ('jammy', 'noble')
- name: lxd snap is installed
snap:
name: lxd
channel: latest/stable
become: true
- name: lxd is initialised
command: lxd init --auto
become: true
- name: allow packets from lxd bridge
command: nft insert rule filter openstack-INPUT iif lxdbr0 accept
become: true
when: ansible_distribution_release in ('jammy', 'noble')
- name: current user is in lxd group
user:
name: "{{ ansible_user }}"
groups: lxd
append: true
become: true
- name: reset ssh connection to apply permissions from new group
meta: reset_connection
- name: charmcraft is installed
snap:
name: charmcraft
channel: "{{ charmcraft_channel | default('latest/stable') }}"
classic: true
become: true
- name: charm is packed
command:
cmd: "{{ tox_executable }} -e build -- {{ charm_build_name }}"
chdir: "{{ zuul.project.src_dir }}"
register: res
retries: 3
delay: 30
until: >
"Charm packed ok" in res.stdout
failed_when: '"Failed instance creation" in res.stdout'
- name: built charm is available in the zuul log root for auto artifact upload
fetch:
src: "{{ zuul.project.src_dir }}/charms/{{ charm_build_name }}/{{ charm_build_name }}.charm"
dest: "{{ zuul.executor.log_root }}/"
flat: true
become: true
- name: Upload artifacts
zuul_return:
data:
zuul:
artifacts:
- name: charm
url: "{{ charm_build_name }}.charm"
metadata:
type: charm
name: "{{ charm_build_name }}"