Skip to content

Commit 432e218

Browse files
committed
Strict patch
1 parent b010bb6 commit 432e218

File tree

10 files changed

+659
-71
lines changed

10 files changed

+659
-71
lines changed

.github/workflows/build-snap.yml

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
name: Build MicroK8s snap on PR and push to master
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
8-
branches:
9-
- master
4+
- push
5+
- pull_request
6+
7+
### While we work on the strict feature we want the tests to run even if we do put PRs against the master.
8+
### When this work get merged into master the following should be commented in.
9+
# push:
10+
# branches:
11+
# - master
12+
# pull_request:
13+
# branches:
14+
# - master
1015

1116
jobs:
1217
build:
@@ -47,24 +52,80 @@ jobs:
4752
- name: Running upgrade path test
4853
run: |
4954
set -x
50-
sudo -E UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=`pwd`/`ls microk8s*.snap` pytest -s ./tests/test-upgrade-path.py
51-
sudo snap remove microk8s --purge
52-
- name: Running addons tests
55+
# Remove the snapd refresh as soon as v2.52 lands
56+
sudo snap refresh snapd --channel=latest/edge
57+
- name: Check branches
58+
run: |
59+
set -x
60+
(cd tests; pytest -s verify-branches.py)
61+
- name: Running addons tests in strict mode
5362
run: |
5463
set -x
55-
sudo snap install *.snap --classic --dangerous
64+
sudo snap install microk8s.snap --dangerous
65+
sudo ./tests/connect-all-interfaces.sh
5666
./tests/smoke-test.sh
5767
export UNDER_TIME_PRESSURE="True"
68+
export SKIP_OPENEBS="True"
5869
export SKIP_PROMETHEUS="False"
5970
(cd tests; pytest -s verify-branches.py)
6071
sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/tests; pytest -s -ra test-addons.py"
6172
sudo microk8s enable community
6273
sudo -E bash -c "cd /var/snap/microk8s/common/addons/community/tests; pytest -s -ra test-addons.py"
74+
grep -Po "Report tarball is at \K.+" |
75+
sudo xargs -I {} mv {} inspection-report-strict-${{ strategy.job-index }}.tar.gz
6376
sudo snap remove microk8s --purge
64-
- name: Running upgrade tests
77+
sudo rm -rf $HOME/.kube
78+
sudo rm -rf $HOME/.config/helm
79+
sudo dmesg | grep 'apparmor="DENIED"' > ./denials-${{ strategy.job-index }}.log
80+
- name: Upload strict inspect tarball
81+
uses: actions/upload-artifact@v2
82+
with:
83+
name: inspection-report-strict-actions
84+
path: ./inspection-report-strict-${{ strategy.job-index }}.tar.gz
85+
- name: Upload AppArmor denials
86+
uses: actions/upload-artifact@v2
87+
with:
88+
name: apparmor-denials
89+
path: ./denials-${{ strategy.job-index }}.log
90+
- name: Running addons tests in devmode
6591
run: |
6692
set -x
67-
sudo snap install *.snap --classic --dangerous
93+
################ Until devmode of docker-support is fixed we skip this part of the tests #######
94+
exit 0
95+
sudo snap install microk8s.snap --devmode --dangerous
96+
sudo ./tests/connect-all-interfaces.sh
97+
./tests/smoke-test.sh
6898
export UNDER_TIME_PRESSURE="True"
69-
sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/ ; UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=`pwd`/`ls microk8s*.snap` pytest -s ./tests/test-upgrade.py"
99+
export SKIP_OPENEBS="False"
100+
export SKIP_PROMETHEUS="False"
101+
(cd tests; sudo -E pytest -s -ra test-addons.py)
102+
sudo microk8s inspect |
103+
grep -Po "Report tarball is at \K.+" |
104+
sudo xargs -I {} mv {} inspection-report-devmode-${{ strategy.job-index }}.tar.gz
70105
sudo snap remove microk8s --purge
106+
- name: Upload devmode inspect tarball
107+
uses: actions/upload-artifact@v2
108+
with:
109+
name: inspection-report-devmode-actions
110+
path: ./inspection-report-devmode-${{ strategy.job-index }}.tar.gz
111+
- name: Generate AppArmor on failure
112+
run: sudo dmesg | grep 'apparmor="DENIED"' > ./denials-${{ strategy.job-index }}.log
113+
if: failure()
114+
- name: Upload AppArmor denials failure
115+
uses: actions/upload-artifact@v2
116+
with:
117+
name: apparmor-denials
118+
path: ./denials-${{ strategy.job-index }}.log
119+
if: failure()
120+
- name: Generate inspect tarball
121+
run: >
122+
sudo microk8s inspect |
123+
grep -Po "Report tarball is at \K.+" |
124+
sudo xargs -I {} mv {} inspection-report-fail-${{ strategy.job-index }}.tar.gz
125+
if: failure()
126+
- name: Upload inspect tarball
127+
uses: actions/upload-artifact@v2
128+
with:
129+
name: inspection-report-actions
130+
path: ./inspection-report-fail-${{ strategy.job-index }}.tar.gz
131+
if: failure()

docs/build.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,16 @@ lxc file pull test-build/root/microk8s/microk8s_v1.9.6_amd64.snap .
8383
After copying it, you can install it with:
8484

8585
```shell
86-
snap install microk8s_*_amd64.snap --classic --dangerous
86+
sudo snap install microk8s_latest_amd64.snap --dangerous
8787
```
8888

89+
Finally, you need to connect the interfaces. To this end you can use the `connect-all-interfaces.sh` under the `tests` directory:
90+
91+
```shell
92+
sudo tests/connect-all-interfaces.sh
93+
```
94+
95+
8996
## Assembling the Calico CNI manifest
9097

9198
The calico CNI manifest can be found under `upgrade-scripts/000-switch-to-calico/resources/calico.yaml`.

scripts/wrappers/common/cluster/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def try_set_file_permissions(file):
2929

3030
os.chmod(file, 0o660)
3131
try:
32-
shutil.chown(file, group="microk8s")
32+
shutil.chown(file, group="snap_microk8s")
3333
except LookupError:
3434
# not setting the group means only the current user can access the file
3535
pass

0 commit comments

Comments
 (0)