8
8
jobs :
9
9
build :
10
10
name : Create snap package
11
- runs-on : ubuntu-20 .04
11
+ runs-on : ubuntu-22 .04
12
12
13
13
steps :
14
14
- name : Checking out repo
18
18
sudo lxd init --auto
19
19
sudo usermod --append --groups lxd $USER
20
20
sg lxd -c 'lxc version'
21
+ # Docker sets iptables rules that interfere with LXD or K8s.
22
+ # https://documentation.ubuntu.com/lxd/en/latest/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-lxd-and-docker
23
+ - name : Apply Docker iptables workaround
24
+ shell : bash
25
+ run : sudo iptables -I DOCKER-USER -j ACCEPT
21
26
- name : Install snapcraft
22
27
run : |
23
28
sudo snap install snapcraft --classic
@@ -37,138 +42,84 @@ jobs:
37
42
38
43
test-upgrade :
39
44
name : Upgrade path test
40
- runs-on : ubuntu-20 .04
45
+ runs-on : ubuntu-22 .04
41
46
needs : build
42
-
47
+ timeout-minutes : 30
43
48
steps :
44
49
- name : Checking out repo
45
50
uses : actions/checkout@v4
46
- - name : Install test dependencies
47
- run : |
48
- set -x
49
- sudo apt-get install python3-setuptools
50
- sudo pip3 install --upgrade pip
51
- sudo pip3 install -U pytest sh psutil
52
- sudo apt-get -y install open-iscsi
53
- sudo systemctl enable iscsid
54
- - name : Fetch snap
55
- uses : actions/download-artifact@v4
56
- with :
57
- name : microk8s.snap
58
- path : build
51
+ - name : Prepare test prerequisites
52
+ uses : ./.github/actions/test-prep
59
53
- name : Running upgrade path test
60
54
run : |
61
55
sudo -E UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade-path.py
62
56
63
57
test-addons-core :
64
58
name : Test core addons
65
- runs-on : ubuntu-20 .04
59
+ runs-on : ubuntu-22 .04
66
60
needs : build
67
-
61
+ timeout-minutes : 30
68
62
steps :
69
63
- name : Checking out repo
70
64
uses : actions/checkout@v4
71
- - name : Install test dependencies
72
- run : |
73
- set -x
74
- sudo apt-get install python3-setuptools
75
- sudo pip3 install --upgrade pip
76
- sudo pip3 install -U pytest==8.3.4 sh psutil
77
- sudo apt-get -y install open-iscsi
78
- sudo systemctl enable iscsid
79
- - name : Fetch snap
80
- uses : actions/download-artifact@v4
81
- with :
82
- name : microk8s.snap
83
- path : build
65
+ - name : Prepare test prerequisites
66
+ uses : ./.github/actions/test-prep
84
67
- name : Running addons tests
68
+ env :
69
+ UNDER_TIME_PRESSURE : ${{ !contains(github.event.pull_request.labels.*.name, 'run-all-tests') }}
85
70
run : |
86
71
set -x
87
72
sudo snap install build/microk8s.snap --classic --dangerous
88
73
./tests/smoke-test.sh
89
- export UNDER_TIME_PRESSURE="True"
90
74
export SKIP_PROMETHEUS="False"
91
75
sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/tests; pytest -s -ra test-addons.py"
92
76
93
77
test-addons-community :
94
78
name : Test community addons
95
- runs-on : ubuntu-20 .04
79
+ runs-on : ubuntu-22 .04
96
80
needs : build
97
-
81
+ timeout-minutes : 30
98
82
steps :
99
83
- name : Checking out repo
100
84
uses : actions/checkout@v4
101
- - name : Install test dependencies
102
- run : |
103
- set -x
104
- sudo apt-get install python3-setuptools
105
- sudo pip3 install --upgrade pip
106
- sudo pip3 install -U pytest sh
107
- sudo apt-get -y install open-iscsi
108
- sudo systemctl enable iscsid
109
- - name : Fetch snap
110
- uses : actions/download-artifact@v4
111
- with :
112
- name : microk8s.snap
113
- path : build
114
- # - name: Setup tmate session
115
- # uses: mxschmitt/action-tmate@v3
85
+ - name : Prepare test prerequisites
86
+ uses : ./.github/actions/test-prep
116
87
- name : Running addons tests
88
+ env :
89
+ UNDER_TIME_PRESSURE : ${{ !contains(github.event.pull_request.labels.*.name, 'run-all-tests') }}
117
90
run : |
118
91
set -x
119
92
sudo snap install build/microk8s.snap --classic --dangerous
120
93
sudo microk8s enable community
121
- export UNDER_TIME_PRESSURE="True"
122
94
sudo -E bash -c "cd /var/snap/microk8s/common/addons/community/; pytest -s -ra ./tests/"
123
95
124
96
test-addons-core-upgrade :
125
97
name : Test core addons upgrade
126
- runs-on : ubuntu-20 .04
98
+ runs-on : ubuntu-22 .04
127
99
needs : build
128
-
100
+ timeout-minutes : 30
129
101
steps :
130
102
- name : Checking out repo
131
103
uses : actions/checkout@v4
132
- # - name: Setup tmate session
133
- # uses: mxschmitt/action-tmate@v3
134
- - name : Install test dependencies
135
- run : |
136
- set -x
137
- sudo apt-get install python3-setuptools
138
- sudo pip3 install --upgrade pip
139
- sudo pip3 install -U pytest sh psutil
140
- sudo apt-get -y install open-iscsi
141
- sudo systemctl enable iscsid
142
- - name : Fetch snap
143
- uses : actions/download-artifact@v4
144
- with :
145
- name : microk8s.snap
146
- path : build
104
+ - name : Prepare test prerequisites
105
+ uses : ./.github/actions/test-prep
147
106
- name : Running upgrade tests
107
+ env :
108
+ UNDER_TIME_PRESSURE : ${{ !contains(github.event.pull_request.labels.*.name, 'run-all-tests') }}
148
109
run : |
149
110
set -x
150
- export UNDER_TIME_PRESSURE="True"
151
111
sudo -E bash -c "UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade.py"
152
112
153
113
test-cluster-agent :
154
114
name : Cluster agent health check
155
- runs-on : ubuntu-20 .04
115
+ runs-on : ubuntu-22 .04
156
116
needs : build
157
-
117
+ timeout-minutes : 30
158
118
steps :
159
119
- name : Checking out repo
160
120
uses : actions/checkout@v4
161
- - name : Install test dependencies
162
- run : |
163
- set -x
164
- sudo apt-get install python3-setuptools
165
- sudo pip3 install --upgrade pip
166
- sudo pip3 install -U pytest sh requests
167
- - name : Fetch snap
168
- uses : actions/download-artifact@v4
169
- with :
170
- name : microk8s.snap
171
- path : build
121
+ - name : Prepare test prerequisites
122
+ uses : ./.github/actions/test-prep
172
123
- name : Running cluster agent health check
173
124
run : |
174
125
set -x
@@ -177,17 +128,14 @@ jobs:
177
128
178
129
test-airgap :
179
130
name : Test airgap installation
180
- runs-on : ubuntu-20 .04
131
+ runs-on : ubuntu-22 .04
181
132
needs : build
182
-
133
+ timeout-minutes : 30
183
134
steps :
184
135
- name : Checking out repo
185
136
uses : actions/checkout@v4
186
- - name : Fetch snap
187
- uses : actions/download-artifact@v4
188
- with :
189
- name : microk8s.snap
190
- path : build
137
+ - name : Prepare test prerequisites
138
+ uses : ./.github/actions/test-prep
191
139
- name : Initialize LXD
192
140
run : |
193
141
sudo lxd init --auto
@@ -196,12 +144,13 @@ jobs:
196
144
sg lxd -c 'lxc version'
197
145
- name : Run airgap tests
198
146
run : |
199
- sudo -E bash -x -c "./tests/libs/airgap.sh --distro ubuntu:20 .04 --channel $PWD/build/microk8s.snap"
147
+ sudo -E bash -x -c "./tests/libs/airgap.sh --distro ubuntu:22 .04 --channel $PWD/build/microk8s.snap"
200
148
201
149
security-scan :
202
150
name : Security scan
203
- runs-on : ubuntu-20 .04
151
+ runs-on : ubuntu-22 .04
204
152
needs : build
153
+ timeout-minutes : 30
205
154
steps :
206
155
- name : Checking out repo
207
156
uses : actions/checkout@v4
0 commit comments