-
Notifications
You must be signed in to change notification settings - Fork 27
230 lines (203 loc) · 8.15 KB
/
nightly-portal-pipeline.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Nightly-Portal-E2E-Pipeline
on:
schedule:
- cron: "30 22 * * *" # Daily 04:30 AM in midnight
# All Environments variables declared and set here.
env:
TAG: "ci"
MODULE: "All"
SELF_AGENT: "self-agent"
EXTERNAL_AGENT: "external-agent"
CS_MODE_NAMESPACE: "litmus"
NS_MODE_NAMESPACE: "default"
# Jobs for deploying and testing litmus-portal on a KinD Cluster
jobs:
Cluster-Scope-Mode:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
AcessType: [NodePort, Ingress, LoadBalancer]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 14
- uses: AbsaOSS/k3d-action@v2
name: Create 1st Cluster
with:
cluster-name: ${{ env.SELF_AGENT }}
k3d-version: v5.2.2
args: >
--agents 3
--k3s-arg "--no-deploy=traefik, metrics-server@server:*"
- name: Configuring and Testing the Cluster Installation
run: |
kubectl cluster-info --context k3d-${{ env.SELF_AGENT }}
kubectl get nodes
kubectl get pods -n kube-system
- name: Deploying Litmus-Portal using **k8s-manifest**
run: |
chmod 755 ./litmus/install-portal.sh
./litmus/install-portal.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
ACCESS_TYPE: ${{ matrix.AcessType }}
NAMESPACE: ${{ env.CS_MODE_NAMESPACE }}
INSTALLATION_MODE: "CS-MODE"
# Fetching Access Point & Token for accessing kube api server
- run: |
kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}'
export CLUSTER_NAME=k3d-${SELF_AGENT}
KUBE_API_SERVER=$(kubectl config view -o jsonpath="{.clusters[?(@.name==\"$CLUSTER_NAME\")].cluster.server}")
KUBE_API_TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
echo "KUBE_API_SERVER=$KUBE_API_SERVER" >> $GITHUB_ENV
echo "KUBE_API_TOKEN=$KUBE_API_TOKEN" >> $GITHUB_ENV
# RBAC for allowing Cypress Runner to access Cluster resources
- run: |
kubectl apply -f Cypress/cypress-rbac.yml
- name: Running basic tests (Login and Onboarding Tests)
uses: cypress-io/github-action@v2
continue-on-error: false
with:
spec: cypress/integration/Basic_Setup/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
- name: Verifying the execution-plane components
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
source ./litmus/utils.sh
verify_all_components ${COMPONENTS} ${NAMESPACE}
wait_for_pods ${NAMESPACE} 720
env:
COMPONENTS: subscriber,chaos-exporter,chaos-operator-ce,event-tracker,workflow-controller
NAMESPACE: ${{ env.CS_MODE_NAMESPACE }}
- name: Running Post-Authentication Tests
uses: cypress-io/github-action@v2
if: always()
continue-on-error: false
with:
spec: cypress/integration/Parallel_Tests/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
CYPRESS_KUBE_API_TOKEN: ${{ env.KUBE_API_TOKEN }}
CYPRESS_KUBE_API_SERVER: ${{ env.KUBE_API_SERVER}}
CYPRESS_AGENT_NAMESPACE: ${{ env.CS_MODE_NAMESPACE}}
CYPRESS_AGENT: "Self-Agent"
CYPRESS_TARGET_APP_NS: "default"
# TODO: Additional Tests will be added from here
- name: Portal Cleanup
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
chmod 755 ./litmus/uninstall-portal.sh
./litmus/uninstall-portal.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: Cluster-Scope-Mode-${{ matrix.AcessType }}-screenshots
path: Cypress/cypress/screenshots
Namespaced-Scope-Mode:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
AcessType: [NodePort, Ingress, LoadBalancer]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 14
- uses: AbsaOSS/k3d-action@v2
name: Create 1st Cluster
with:
cluster-name: ${{ env.SELF_AGENT }}
k3d-version: v5.2.2
args: >
--agents 3
--k3s-arg "--no-deploy=traefik, metrics-server@server:*"
- name: Configuring and Testing the Cluster Installation
run: |
kubectl cluster-info --context k3d-${{ env.SELF_AGENT }}
kubectl get nodes
kubectl get pods -n kube-system
- name: Deploying Litmus-Portal using **k8s-manifest**
run: |
chmod 755 ./litmus/install-portal.sh
./litmus/install-portal.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
ACCESS_TYPE: ${{ matrix.AcessType }}
NAMESPACE: ${{ env.NS_MODE_NAMESPACE }}
INSTALLATION_MODE: "NS-MODE"
# Fetching Access Point & Token for accessing kube api server
- run: |
kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}'
export CLUSTER_NAME=k3d-${SELF_AGENT}
KUBE_API_SERVER=$(kubectl config view -o jsonpath="{.clusters[?(@.name==\"$CLUSTER_NAME\")].cluster.server}")
KUBE_API_TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
echo "KUBE_API_SERVER=$KUBE_API_SERVER" >> $GITHUB_ENV
echo "KUBE_API_TOKEN=$KUBE_API_TOKEN" >> $GITHUB_ENV
# RBAC for allowing Cypress Runner to access Cluster resources
- run: |
kubectl apply -f Cypress/cypress-rbac.yml
- name: Running basic tests (Login and Onboarding Tests)
uses: cypress-io/github-action@v2
continue-on-error: false
with:
spec: cypress/integration/Basic_Setup/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
- name: Verifying the execution-plane components
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
source ./litmus/utils.sh
verify_all_components ${COMPONENTS} ${NAMESPACE}
wait_for_pods ${NAMESPACE} 720
env:
COMPONENTS: subscriber,chaos-exporter,chaos-operator-ce,event-tracker,workflow-controller
NAMESPACE: ${{ env.NS_MODE_NAMESPACE }}
- name: Running Post-Authentication Tests
uses: cypress-io/github-action@v2
if: always()
continue-on-error: false
with:
spec: cypress/integration/Parallel_Tests/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
CYPRESS_KUBE_API_TOKEN: ${{ env.KUBE_API_TOKEN }}
CYPRESS_KUBE_API_SERVER: ${{ env.KUBE_API_SERVER}}
CYPRESS_AGENT_NAMESPACE: ${{ env.NS_MODE_NAMESPACE}}
CYPRESS_AGENT: "Self-Agent"
CYPRESS_TARGET_APP_NS: ${{ env.NS_MODE_NAMESPACE}}
# TODO: Additional Tests will be added from here
- name: Portal Cleanup
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
chmod 755 ./litmus/uninstall-portal-namespaced.sh
./litmus/uninstall-portal-namespaced.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
PORTAL_NAMESPACE: ${{ env.NS_MODE_NAMESPACE }}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: Namespaced-Scope-Mode-${{ matrix.AcessType }}-screenshots
path: Cypress/cypress/screenshots