-
Notifications
You must be signed in to change notification settings - Fork 105
199 lines (172 loc) · 8.61 KB
/
run-integration-tests.yml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Minikube Integration Tests
on: pull_request
jobs:
run-integration-test:
name: Run Minikube Integration Tests
runs-on: ubuntu-latest
env:
KUBECONFIG: /home/runner/.kube/config
steps:
- uses: actions/checkout@v2
- name: Building latest changes
run: |
npm install
npm run build
- name: Set name of ns
run: echo "::set-output name=name::$(echo `date +%Y%m%d%H%M%S`)"
shell: bash
id: ns
- uses: Azure/setup-kubectl@v1
name: Install Kubectl
- id: setup-minikube
name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: "v1.24.0"
kubernetes version: "v1.17.8"
driver: "none"
timeout-minutes: 3
- name: Create namespace to run tests
run: kubectl create ns test-${{ steps.ns.outputs.name }}
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.x"
- name: Cleaning any previously created items
run: |
python test/integration/k8s-deploy-delete.py 'Service' 'nginx-service' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-delete.py 'Service' 'nginx-service-green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-delete.py 'Deployment' 'nginx-deployment-green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-delete.py 'Deployment' 'nginx-deployment' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-delete.py 'Ingress' 'nginx-ingress' ${{ steps.ns.outputs.name }}
- name: Executing deploy action
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.14.2
manifests: |
test/integration/manifests/test-service.yml
strategy: blue-green
route-method: service
action: deploy
- name: Checking if deploments and services were created with green labels
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment-green' 'green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service' 'green' ${{ steps.ns.outputs.name }}
- name: Executing promote action
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.14.2
manifests: |
test/integration/manifests/test-service.yml
strategy: blue-green
route-method: service
action: promote
- name: Checking if deploments and services were created with none labels after promote
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service' 'None' ${{ steps.ns.outputs.name }}
- name: Executing deploy action on
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.19.1
manifests: |
test/integration/manifests/test-service.yml
strategy: blue-green
route-method: service
action: deploy
- name: Checking if deploments and services were created with green labels, and old workloads persist on deploy
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment-green' 'green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service' 'green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment' 'None' ${{ steps.ns.outputs.name }}
- name: Executing reject action
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.19.1
manifests: |
test/integration/manifests/test-service.yml
strategy: blue-green
route-method: service
action: reject
- name: Checking if deploments and services were routed back to none labels after reject
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service' 'None' ${{ steps.ns.outputs.name }}
- name: Cleaning up current set up
run: |
python test/integration/k8s-deploy-delete.py 'Service' 'nginx-service' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-delete.py 'Deployment' 'nginx-deployment' ${{ steps.ns.outputs.name }}
- name: Executing deploy action for ingress
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.14.2
manifests: |
test/integration/manifests/test-ingress.yml
strategy: blue-green
route-method: ingress
action: deploy
- name: Checking if deploments, services and ingresses were created with green labels
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment-green' 'green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service-green' 'green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Ingress' 'nginx-ingress' 'green' ${{ steps.ns.outputs.name }}
- name: Executing promote action for ingress
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.14.2
manifests: |
test/integration/manifests/test-ingress.yml
strategy: blue-green
route-method: ingress
action: promote
- name: Checking if deploments, services and ingresses were created with none labels after promote
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Ingress' 'nginx-ingress' 'None' ${{ steps.ns.outputs.name }}
- name: Executing deploy action for ingress
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.19.1
manifests: |
test/integration/manifests/test-ingress.yml
strategy: blue-green
route-method: ingress
action: deploy
- name: Checking if deploments, services and ingresses were created with green labels after deploy, and old deployment persists
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment-green' 'green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service-green' 'green' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Ingress' 'nginx-ingress' 'green' ${{ steps.ns.outputs.name }}
- name: Executing reject action for ingress
uses: ./
with:
namespace: test-${{ steps.ns.outputs.name }}
images: nginx:1.19.1
manifests: |
test/integration/manifests/test-ingress.yml
strategy: blue-green
route-method: ingress
action: reject
- name: Checking if deploments, services and ingresses were created with none labels after reject
run: |
python test/integration/k8s-deploy-test.py 'Deployment' 'nginx-deployment' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Service' 'nginx-service' 'None' ${{ steps.ns.outputs.name }}
python test/integration/k8s-deploy-test.py 'Ingress' 'nginx-ingress' 'None' ${{ steps.ns.outputs.name }}
- if: ${{ always() }}
name: Delete created namespace
run: kubectl delete ns test-${{ steps.ns.outputs.name }}
- if: ${{ always() }}
name: Posting result back to PR
run: |
if [ '${{ steps.job-type.outputs.type }}' == 'pr' ]; then ruby postStatus.rb ${{github.event.client_payload.repository}} ${{github.event.client_payload.commit}} ${{secrets.L2_REPO_TOKEN}} ${{job.status}} ${{github.run_id}} ${{matrix.os}} false ${{ secrets.L2_REPO_USER }}; fi
shell: bash