|
1 | 1 | name: Build MicroK8s snap on PR and push to master |
2 | 2 |
|
3 | 3 | 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 |
10 | 15 |
|
11 | 16 | jobs: |
12 | 17 | build: |
@@ -43,24 +48,80 @@ jobs: |
43 | 48 | - name: Running upgrade path test |
44 | 49 | run: | |
45 | 50 | set -x |
46 | | - sudo -E UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=`pwd`/`ls microk8s*.snap` pytest -s ./tests/test-upgrade-path.py |
47 | | - sudo snap remove microk8s --purge |
48 | | - - name: Running addons tests |
| 51 | + # Remove the snapd refresh as soon as v2.52 lands |
| 52 | + sudo snap refresh snapd --channel=latest/edge |
| 53 | + - name: Check branches |
| 54 | + run: | |
| 55 | + set -x |
| 56 | + (cd tests; pytest -s verify-branches.py) |
| 57 | + - name: Running addons tests in strict mode |
49 | 58 | run: | |
50 | 59 | set -x |
51 | | - sudo snap install *.snap --classic --dangerous |
| 60 | + sudo snap install microk8s.snap --dangerous |
| 61 | + sudo ./tests/connect-all-interfaces.sh |
52 | 62 | ./tests/smoke-test.sh |
53 | 63 | export UNDER_TIME_PRESSURE="True" |
| 64 | + export SKIP_OPENEBS="True" |
54 | 65 | export SKIP_PROMETHEUS="False" |
55 | 66 | (cd tests; pytest -s verify-branches.py) |
56 | 67 | sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/tests; pytest -s -ra test-addons.py" |
57 | 68 | sudo microk8s enable community |
58 | 69 | sudo -E bash -c "cd /var/snap/microk8s/common/addons/community/tests; pytest -s -ra test-addons.py" |
| 70 | + grep -Po "Report tarball is at \K.+" | |
| 71 | + sudo xargs -I {} mv {} inspection-report-strict-${{ strategy.job-index }}.tar.gz |
59 | 72 | sudo snap remove microk8s --purge |
60 | | - - name: Running upgrade tests |
| 73 | + sudo rm -rf $HOME/.kube |
| 74 | + sudo rm -rf $HOME/.config/helm |
| 75 | + sudo dmesg | grep 'apparmor="DENIED"' > ./denials-${{ strategy.job-index }}.log |
| 76 | + - name: Upload strict inspect tarball |
| 77 | + uses: actions/upload-artifact@v2 |
| 78 | + with: |
| 79 | + name: inspection-report-strict-actions |
| 80 | + path: ./inspection-report-strict-${{ strategy.job-index }}.tar.gz |
| 81 | + - name: Upload AppArmor denials |
| 82 | + uses: actions/upload-artifact@v2 |
| 83 | + with: |
| 84 | + name: apparmor-denials |
| 85 | + path: ./denials-${{ strategy.job-index }}.log |
| 86 | + - name: Running addons tests in devmode |
61 | 87 | run: | |
62 | 88 | set -x |
63 | | - sudo snap install *.snap --classic --dangerous |
| 89 | + ################ Until devmode of docker-support is fixed we skip this part of the tests ####### |
| 90 | + exit 0 |
| 91 | + sudo snap install microk8s.snap --devmode --dangerous |
| 92 | + sudo ./tests/connect-all-interfaces.sh |
| 93 | + ./tests/smoke-test.sh |
64 | 94 | export UNDER_TIME_PRESSURE="True" |
65 | | - 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" |
| 95 | + export SKIP_OPENEBS="False" |
| 96 | + export SKIP_PROMETHEUS="False" |
| 97 | + (cd tests; sudo -E pytest -s -ra test-addons.py) |
| 98 | + sudo microk8s inspect | |
| 99 | + grep -Po "Report tarball is at \K.+" | |
| 100 | + sudo xargs -I {} mv {} inspection-report-devmode-${{ strategy.job-index }}.tar.gz |
66 | 101 | sudo snap remove microk8s --purge |
| 102 | + - name: Upload devmode inspect tarball |
| 103 | + uses: actions/upload-artifact@v2 |
| 104 | + with: |
| 105 | + name: inspection-report-devmode-actions |
| 106 | + path: ./inspection-report-devmode-${{ strategy.job-index }}.tar.gz |
| 107 | + - name: Generate AppArmor on failure |
| 108 | + run: sudo dmesg | grep 'apparmor="DENIED"' > ./denials-${{ strategy.job-index }}.log |
| 109 | + if: failure() |
| 110 | + - name: Upload AppArmor denials failure |
| 111 | + uses: actions/upload-artifact@v2 |
| 112 | + with: |
| 113 | + name: apparmor-denials |
| 114 | + path: ./denials-${{ strategy.job-index }}.log |
| 115 | + if: failure() |
| 116 | + - name: Generate inspect tarball |
| 117 | + run: > |
| 118 | + sudo microk8s inspect | |
| 119 | + grep -Po "Report tarball is at \K.+" | |
| 120 | + sudo xargs -I {} mv {} inspection-report-fail-${{ strategy.job-index }}.tar.gz |
| 121 | + if: failure() |
| 122 | + - name: Upload inspect tarball |
| 123 | + uses: actions/upload-artifact@v2 |
| 124 | + with: |
| 125 | + name: inspection-report-actions |
| 126 | + path: ./inspection-report-fail-${{ strategy.job-index }}.tar.gz |
| 127 | + if: failure() |
0 commit comments