-
Notifications
You must be signed in to change notification settings - Fork 504
240 lines (234 loc) · 8.8 KB
/
e2e.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
231
232
233
234
235
236
237
238
239
240
##################################################################################
#
# This file is automatically generated using templates. Changes to this file
# should happen through editing the templates under .action_templates/*
# Manual edits will be overwritten.
#
##################################################################################
name: Run E2E
on:
# template: .action_templates/events/on-pull-request-master.yaml
pull_request:
branches:
- master
paths-ignore:
- docs/**
# template: .action_templates/events/on-push-master.yaml
push:
branches:
- master
paths-ignore:
- docs/**
# template: .action_templates/events/workflow-dispatch.yaml
workflow_dispatch: {}
jobs:
# template: .action_templates/jobs/display-github-context.yaml
action-context:
if: always()
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
# template: .action_templates/jobs/setup.yaml
setup:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- pipeline-argument: operator
- pipeline-argument: version-upgrade-hook
- pipeline-argument: readiness-probe
- pipeline-argument: agent
- pipeline-argument: e2e
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master'
|| (github.event.pull_request.head.repo.full_name == github.repository && github.actor
!= 'dependabot[bot]')
steps:
# template: .action_templates/steps/cancel-previous.yaml
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@89f242ee29e10c53a841bfe71cc0ce7b2f065abc # 0.9.0
with:
access_token: ${{ github.token }}
# template: .action_templates/steps/checkout.yaml
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: true
# template: .action_templates/steps/setup-and-install-python.yaml
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.10.4
- name: Cache Dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ hashFiles('requirements.txt') }}
- name: Install Python Dependencies
run: pip install -r requirements.txt
# template: .action_templates/steps/quay-login.yaml
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
# template: .action_templates/steps/set-up-qemu.yaml
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# template: .action_templates/steps/build-and-push-development-images.yaml
- name: Build and Push Images
run: |
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --tag ${{ github.run_id }}
env:
MONGODB_COMMUNITY_CONFIG: ${{ github.workspace }}/scripts/ci/config.json
version_id: ${{ github.run_id }}
# template: .action_templates/jobs/tests.yaml
tests:
runs-on: ubuntu-latest
needs: [setup]
strategy:
fail-fast: false
matrix:
include:
- test-name: replica_set
distro: ubi
- test-name: replica_set_enterprise_upgrade_4_5
distro: ubi
- test-name: replica_set_enterprise_upgrade_5_6
distro: ubi
- test-name: replica_set_enterprise_upgrade_6_7
distro: ubi
- test-name: replica_set_recovery
distro: ubi
- test-name: replica_set_mongod_readiness
distro: ubi
- test-name: replica_set_scale
distro: ubi
- test-name: replica_set_scale_down
distro: ubi
- test-name: replica_set_change_version
distro: ubi
- test-name: feature_compatibility_version
distro: ubi
- test-name: prometheus
distro: ubi
- test-name: replica_set_tls
distro: ubi
- test-name: replica_set_tls_recreate_mdbc
distro: ubi
- test-name: replica_set_tls_rotate
distro: ubi
- test-name: replica_set_tls_rotate_delete_sts
distro: ubi
- test-name: replica_set_tls_upgrade
distro: ubi
- test-name: statefulset_arbitrary_config
distro: ubi
- test-name: statefulset_arbitrary_config_update
distro: ubi
- test-name: replica_set_mongod_config
distro: ubi
- test-name: replica_set_cross_namespace_deploy
distro: ubi
cluster-wide: true
- test-name: replica_set_custom_role
distro: ubi
- test-name: replica_set_arbiter
distro: ubi
- test-name: replica_set_custom_persistent_volume
distro: ubi
- test-name: replica_set_mount_connection_string
distro: ubi
- test-name: replica_set_mongod_port_change_with_arbiters
distro: ubi
- test-name: replica_set_operator_upgrade
distro: ubi
- test-name: replica_set_connection_string_options
distro: ubi
- test-name: replica_set_x509
distro: ubi
steps:
# template: .action_templates/steps/cancel-previous.yaml
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@89f242ee29e10c53a841bfe71cc0ce7b2f065abc # 0.9.0
with:
access_token: ${{ github.token }}
# template: .action_templates/steps/checkout.yaml
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: true
# template: .action_templates/steps/set-run-status.yaml
- name: Set default run status
run: echo "::set-output name=last_run_status::pending" > last_run_status
# Tracking of the state of the previous test run is a workaround to the fact that it is not
# possible to re-run a single failed job, only re-running the entire workflow is currently possible.
# This workaround skips jobs if they have already passed.
# see https://github.com/actions/runner/issues/432
- name: Restore last run status
id: last_run
uses: actions/cache@v2
with:
path: last_run_status
key: ${{ github.run_id }}-${{ matrix.test-name }}-${{ matrix.distro }}
- name: Set last run status
id: last_run_status
run: cat last_run_status
# template: .action_templates/steps/setup-and-install-python.yaml
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.10.4
- name: Cache Dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ hashFiles('requirements.txt') }}
- name: Install Python Dependencies
run: pip install -r requirements.txt
# template: .action_templates/steps/setup-kind-cluster.yaml
- name: Setup Kind Cluster
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
./kind create cluster
if: steps.last_run_status.outputs.last_run_status != 'success'
- name: Create Directories
run: |
docker exec kind-control-plane mkdir -p /opt/data/mongo-data-0 /opt/data/mongo-data-1 /opt/data/mongo-data-2 /opt/data/mongo-logs-0 /opt/data/mongo-logs-1 /opt/data/mongo-logs-2
if: steps.last_run_status.outputs.last_run_status != 'success'
- name: Install CRD
run: kubectl apply -f config/crd/bases/mongodbcommunity.mongodb.com_mongodbcommunity.yaml
if: steps.last_run_status.outputs.last_run_status != 'success'
# template: .action_templates/steps/run-test-matrix.yaml
- name: Run Test
id: e2e_test
if: steps.last_run_status.outputs.last_run_status != 'success'
run: |
cluster_wide=${{ matrix.cluster-wide }}
if [ -z "$cluster_wide" ]; then
cluster_wide="false"
fi
python3 ./scripts/dev/e2e.py --test ${{ matrix.test-name }} --tag ${{ github.run_id }} --config_file ./scripts/ci/config.json --distro ${{ matrix.distro }} --cluster-wide ${cluster_wide}
# template: .action_templates/steps/save-run-status.yaml
- name: Save run status
if: always()
run: echo "::set-output name=last_run_status::${{ steps.e2e_test.outcome }}"
> last_run_status
# template: .action_templates/steps/dump-and-upload-diagnostics.yaml
- name: Dump Diagnostics
id: dump_diagnostics
if: always() && steps.e2e_test.outcome == 'failure'
continue-on-error: true
run: scripts/ci/dump_diagnostics.sh default # default since kind is running in the default namespace
- name: Upload Diagnostics
if: always() && steps.dump_diagnostics.outcome == 'success'
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: ${{ matrix.test-name }}-${{ matrix.distro }}-diagnostics
path: ${{ github.workspace }}/diagnostics