Skip to content

Commit 9db5699

Browse files
committed
ci: add nested matrix test job with targeted cleanup
- Add tests job that runs e2e tests in matrix - Use storage_name in RUN_ID for individual cleanup per matrix leg - Fix VirtualMachineClass to use v1alpha3 instead of deprecated v1alpha2 - Increase kubectl timeout to 30s for webhook validation Signed-off-by: Anton Yachmenev <anton.yachmenev@flant.com>
1 parent 2ec6d93 commit 9db5699

3 files changed

Lines changed: 130 additions & 9 deletions

File tree

.github/workflows/e2e-matrix.yml

Lines changed: 128 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ name: E2E Storage Matrix
1717
on:
1818
push:
1919
branches:
20-
- chore/ci/e2e-matrix-skeleton
20+
- ci-nested-matrix-test-run
2121
pull_request:
2222
types: [opened, reopened, synchronize, labeled, unlabeled]
2323
branches:
24-
- main
25-
- chore/ci/e2e-matrix-skeleton
24+
- ci-e2e-nested-sds
2625
schedule:
2726
- cron: "30 2 * * *"
2827
workflow_dispatch:
@@ -58,6 +57,12 @@ jobs:
5857
IMAGE_STORAGE_CLASS: ${{ matrix.image_storage_class }}
5958
ATTACH_DISK_SIZE: ${{ matrix.attach_disk_size }}
6059
DATA_DISK_COUNT: ${{ matrix.data_disk_count }}
60+
outputs:
61+
run_id: ${{ steps.setup-output.outputs.run_id }}
62+
run_artifact: ${{ steps.setup-output.outputs.run_artifact }}
63+
profile: ${{ steps.setup-output.outputs.profile }}
64+
storage_name: ${{ steps.setup-output.outputs.storage_name }}
65+
storage_class: ${{ steps.setup-output.outputs.storage_class }}
6166
steps:
6267
- uses: actions/checkout@v4
6368

@@ -109,9 +114,125 @@ jobs:
109114
run: |
110115
task ci:setup-nested-env
111116
117+
- name: Export setup outputs
118+
id: setup-output
119+
run: |
120+
set -euo pipefail
121+
echo "run_id=${RUN_ID}" >> "$GITHUB_OUTPUT"
122+
echo "run_artifact=nested-run-${RUN_ID}" >> "$GITHUB_OUTPUT"
123+
echo "profile=${PROFILE}" >> "$GITHUB_OUTPUT"
124+
echo "storage_name=${{ matrix.storage_name }}" >> "$GITHUB_OUTPUT"
125+
echo "storage_class=${STORAGE_CLASS}" >> "$GITHUB_OUTPUT"
126+
127+
- name: Upload nested artifacts
128+
if: always()
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: ${{ steps.setup-output.outputs.run_artifact }}
132+
path: |
133+
ci/dvp-e2e/tmp/runs/${{ env.RUN_ID }}
134+
if-no-files-found: error
135+
136+
tests:
137+
name: Run E2E (${{ matrix.profile }} / ${{ matrix.storage_class }})
138+
runs-on: ubuntu-latest
139+
needs: setup
140+
timeout-minutes: 300
141+
strategy:
142+
matrix:
143+
include:
144+
- profile: sds-replicated-volume
145+
storage_name: sds
146+
storage_class: linstor-thin-r2
147+
parent_storage_class: linstor-thin-r1-immediate
148+
image_storage_class: linstor-thin-r1-immediate
149+
attach_disk_size: 10Gi
150+
data_disk_count: 2
151+
env:
152+
GO_VERSION: "1.24.6"
153+
TIMEOUT: 4h
154+
RUN_ID: nightly-nested-e2e-${{ matrix.storage_name }}-${{ github.run_number }}
155+
steps:
156+
- uses: actions/checkout@v4
157+
158+
- name: Set up Go ${{ env.GO_VERSION }}
159+
uses: actions/setup-go@v5
160+
with:
161+
go-version: ${{ env.GO_VERSION }}
162+
163+
- name: Install Task
164+
uses: arduino/setup-task@v2
165+
with:
166+
version: 3.x
167+
repo-token: ${{ secrets.GITHUB_TOKEN }}
168+
169+
- name: Install kubectl
170+
uses: azure/setup-kubectl@v4
171+
with:
172+
version: "latest"
173+
174+
- name: Setup d8 CLI
175+
uses: werf/trdl/actions/setup-app@v0.12.2
176+
with:
177+
repo: d8
178+
url: https://deckhouse.ru/downloads/deckhouse-cli-trdl/
179+
root-version: 1
180+
root-sha512: 343bd5f0d8811254e5f0b6fe2923729df3515cb11372dc3899c70df172a4e54c8a596a73d67ae790466a0491
181+
group: 0
182+
channel: stable
183+
184+
- name: Install ginkgo
185+
working-directory: test/e2e
186+
run: |
187+
go install tool
188+
189+
- name: Download dependencies
190+
working-directory: test/e2e
191+
run: |
192+
go mod download
193+
194+
- name: Download nested run artifacts
195+
uses: actions/download-artifact@v4
196+
with:
197+
name: nested-run-${{ env.RUN_ID }}
198+
path: ci/dvp-e2e/tmp/runs
199+
200+
- name: Configure kubeconfig env
201+
run: |
202+
set -euo pipefail
203+
NESTED_KUBECONFIG="${GITHUB_WORKSPACE}/ci/dvp-e2e/tmp/runs/${RUN_ID}/nested/kubeconfig"
204+
if [ ! -s "$NESTED_KUBECONFIG" ]; then
205+
echo "[ERR] Nested kubeconfig not found at $NESTED_KUBECONFIG" >&2
206+
exit 1
207+
fi
208+
echo "KUBECONFIG=$NESTED_KUBECONFIG" >> "$GITHUB_ENV"
209+
210+
- name: Wait for nested API server
211+
run: |
212+
set -euo pipefail
213+
for i in $(seq 1 30); do
214+
if kubectl --request-timeout=15s get nodes >/dev/null 2>&1; then
215+
echo "[INFO] Nested cluster is reachable"
216+
exit 0
217+
fi
218+
echo "[INFO] Waiting for nested API... ($i/30)"
219+
sleep 10
220+
done
221+
echo "[ERR] Nested API server did not become ready in time" >&2
222+
exit 1
223+
224+
- name: Run E2E tests
225+
working-directory: test/e2e
226+
env:
227+
STORAGE_CLASS_NAME: ${{ matrix.storage_class }}
228+
run: |
229+
task run:ci -v
230+
112231
cleanup:
113232
name: Cleanup (${{ matrix.profile }})
114-
needs: setup
233+
needs:
234+
- setup
235+
- tests
115236
if: always()
116237
runs-on: ubuntu-latest
117238
strategy:
@@ -124,8 +245,6 @@ jobs:
124245
image_storage_class: linstor-thin-r1-immediate
125246
attach_disk_size: 10Gi
126247
data_disk_count: 2
127-
env:
128-
CLEANUP_PREFIX: ${{ vars.CLEANUP_PREFIX || 'nightly-nested-e2e-' }}
129248
steps:
130249
- uses: actions/checkout@v4
131250

@@ -142,7 +261,9 @@ jobs:
142261
- name: Cleanup test namespaces
143262
working-directory: ci/dvp-e2e
144263
run: |
264+
# Cleanup specific RUN_ID for this matrix leg
265+
RUN_ID="nightly-nested-e2e-${{ matrix.storage_name }}-${{ github.run_number }}"
145266
task cleanup:namespaces \
146-
PREFIX="${CLEANUP_PREFIX}" \
267+
PREFIX="${RUN_ID}" \
147268
API_URL="${E2E_K8S_URL}" \
148269
SA_TOKEN="${{ secrets.E2E_NESTED_SA_SECRET }}"

ci/dvp-e2e/Taskfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ tasks:
238238
env:
239239
KUBECONFIG: '{{ .PARENT_KUBECONFIG | default (env "KUBECONFIG") | default "" }}'
240240
cmds:
241-
- kubectl apply --server-side --force-conflicts --validate=false -f {{ .TMP_DIR }}/infra.yaml || kubectl apply --validate=false -f {{ .TMP_DIR }}/infra.yaml
241+
- kubectl apply --server-side --force-conflicts --validate=false --request-timeout=30s -f {{ .TMP_DIR }}/infra.yaml || kubectl apply --validate=false --request-timeout=30s -f {{ .TMP_DIR }}/infra.yaml
242242
- |
243243
# Persist SSH keypair in parent cluster namespace for diagnostics tools (nested_diag.sh)
244244
# Secret contains private and public parts; will be removed with namespace cleanup

ci/dvp-e2e/charts/infra/templates/vmc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: virtualization.deckhouse.io/v1alpha2
1+
apiVersion: virtualization.deckhouse.io/v1alpha3
22
kind: VirtualMachineClass
33
metadata:
44
name: "{{ .Values.namespace }}-cpu"

0 commit comments

Comments
 (0)