-
Notifications
You must be signed in to change notification settings - Fork 16
84 lines (79 loc) · 2.89 KB
/
k8s-snap-integration.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Integration Test K8s-snap
on:
push:
branches: ["master"]
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: K8s-snap Integration Test
runs-on: self-hosted-linux-amd64-jammy-large
steps:
- name: Checking out repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Download latest k8s-snap
run: |
sudo snap download k8s --channel=latest/edge --basename k8s
- name: Install lxd
run: |
sudo snap refresh lxd --channel 5.21/stable
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
# Docker sets iptables rules that interfere with LXD.
# https://documentation.ubuntu.com/lxd/en/latest/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-lxd-and-docker
- name: Apply Docker iptables workaround
shell: bash
run: |
sudo iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT
sudo iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
- name: Build k8s-dqlite
run: |
make static
- name: Unpack Snap
run: |
sudo unsquashfs -d snap-unpack-dir k8s.snap
- name: Replace k8s-dqlite binary
run: |
sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite
sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite
- name: Repack Snap
run: |
sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments
- name: Running
env:
TEST_SNAP: ${{ github.workspace }}/k8s-updated.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ubuntu:22.04
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
# Test the latest (up to) 6 releases for the flavour
TEST_VERSION_UPGRADE_CHANNELS: "recent 6 classic"
# Upgrading from 1.30 is not supported.
TEST_VERSION_UPGRADE_MIN_RELEASE: "1.31"
run: |
git clone https://github.com/canonical/k8s-snap.git
cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration -- --tags up_to_nightly'
- name: Prepare inspection reports
if: failure()
run: |
tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports
- name: Upload inspection report artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: inspection-reports
path: ${{ github.workspace }}/inspection-reports.tar.gz