Hemanth Nakkina e8666ea678
Configure charm build on jammy
Insert nft rule on openstack-INPUT chain allowing incoming traffic on
lxdbr0.
Switch charmbuild to 2.x/stable.

Change-Id: I1ccb90cf46751875c0e1b4b528e7bab1e6befc13
2023-12-04 18:10:01 +01: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 == 'jammy'
- 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 == 'jammy'
- 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 }}"