|
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: |
@@ -47,24 +52,80 @@ jobs: |
47 | 52 | - name: Running upgrade path test |
48 | 53 | run: | |
49 | 54 | 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 |
53 | 62 | run: | |
54 | 63 | set -x |
55 | | - sudo snap install *.snap --classic --dangerous |
| 64 | + sudo snap install microk8s.snap --dangerous |
| 65 | + sudo ./tests/connect-all-interfaces.sh |
56 | 66 | ./tests/smoke-test.sh |
57 | 67 | export UNDER_TIME_PRESSURE="True" |
| 68 | + export SKIP_OPENEBS="True" |
58 | 69 | export SKIP_PROMETHEUS="False" |
59 | 70 | (cd tests; pytest -s verify-branches.py) |
60 | 71 | sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/tests; pytest -s -ra test-addons.py" |
61 | 72 | sudo microk8s enable community |
62 | 73 | 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 |
63 | 76 | 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 |
65 | 91 | run: | |
66 | 92 | 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 |
68 | 98 | 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 |
70 | 105 | 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() |
0 commit comments