Skip to content

Commit ff007a7

Browse files
committed
refactor(ci): consolidate e2e workflow, move bootstrap to task, use matrix include
1 parent 9fa177e commit ff007a7

File tree

6 files changed

+205
-203
lines changed

6 files changed

+205
-203
lines changed

.github/workflows/e2e-matrix.yml

Lines changed: 55 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: E2E Matrix Tests (Skeleton)
15+
name: E2E Storage Matrix
1616

1717
on:
1818
push:
@@ -30,67 +30,34 @@ on:
3030
permissions:
3131
contents: read
3232

33-
concurrency:
34-
group: e2e-matrix-${{ github.head_ref || github.ref_name }}
35-
cancel-in-progress: true
36-
3733
env:
3834
E2E_K8S_URL: https://api.e2e.virtlab.flant.com
3935

4036
jobs:
41-
# ============================================
42-
# 1. SETUP - Environment preparation
43-
# ============================================
44-
setup-nested-envs:
45-
name: Setup Nested Envs
46-
runs-on: ubuntu-latest
47-
concurrency:
48-
group: setup-nested-envs-${{ github.head_ref || github.ref_name }}
49-
cancel-in-progress: true
50-
outputs:
51-
run_id: ${{ steps.prep.outputs.run_id }}
52-
profile: ${{ steps.load.outputs.profile }}
53-
steps:
54-
- uses: actions/checkout@v4
55-
56-
- name: Load storage profile
57-
id: load
58-
run: |
59-
cd ci/dvp-e2e
60-
# Map sds-replicated-volume to sds profile from profiles.json
61-
PROFILE=$(jq -r '.[0].name' profiles.json)
62-
echo "profile=$PROFILE" >> "$GITHUB_OUTPUT"
63-
echo "Will test profile: $PROFILE (mapped from sds-replicated-volume)"
64-
65-
- name: Prepare run context
66-
id: prep
67-
run: |
68-
RUN_ID="nightly-nested-e2e-sds-$(date +%H%M%S)"
69-
PROFILE="${{ steps.load.outputs.profile }}"
70-
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
71-
mkdir -p ./tmp/run-context
72-
{
73-
echo "profile: ${PROFILE}"
74-
echo "run_id: ${RUN_ID}"
75-
echo "timestamp: $(date -Iseconds)"
76-
} > ./tmp/run-context/config.yaml
77-
78-
# ============================================
79-
# 2. PREPARE - Cluster preparation
80-
# ============================================
81-
prepare:
82-
name: Prepare Cluster
83-
needs: [setup-nested-envs]
37+
setup:
38+
name: Setup (${{ matrix.profile }})
8439
runs-on: ubuntu-latest
85-
timeout-minutes: 300
40+
strategy:
41+
matrix:
42+
include:
43+
- profile: sds-replicated-volume
44+
storage_name: sds
45+
storage_class: linstor-thin-r2
46+
parent_storage_class: linstor-thin-r1-immediate
47+
image_storage_class: linstor-thin-r1-immediate
48+
attach_disk_size: 10Gi
49+
data_disk_count: 2
8650
concurrency:
87-
group: prepare-${{ github.head_ref || github.ref_name }}-${{ needs.setup-nested-envs.outputs.profile }}
51+
group: setup-${{ github.head_ref || github.ref_name }}-${{ matrix.profile }}
8852
cancel-in-progress: true
8953
env:
90-
PROFILE: ${{ needs.setup-nested-envs.outputs.profile }}
91-
TMP_ROOT: ${{ github.workspace }}/ci/dvp-e2e/tmp
92-
REGISTRY_DOCKER_CFG: ${{ secrets.DEV_REGISTRY_DOCKER_CFG }}
93-
54+
RUN_ID: nightly-nested-e2e-${{ matrix.storage_name }}-${{ github.run_number }}
55+
PROFILE: ${{ matrix.profile }}
56+
STORAGE_CLASS: ${{ matrix.storage_class }}
57+
PARENT_STORAGE_CLASS: ${{ matrix.parent_storage_class }}
58+
IMAGE_STORAGE_CLASS: ${{ matrix.image_storage_class }}
59+
ATTACH_DISK_SIZE: ${{ matrix.attach_disk_size }}
60+
DATA_DISK_COUNT: ${{ matrix.data_disk_count }}
9461
steps:
9562
- uses: actions/checkout@v4
9663

@@ -126,116 +93,56 @@ jobs:
12693
curl -L -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.44.1/yq_linux_amd64
12794
chmod +x /usr/local/bin/yq
12895
129-
- name: Prepare environment
130-
id: prep
131-
run: |
132-
RUN_ID="${{ needs.setup-nested-envs.outputs.run_id }}"
133-
echo "RUN_ID=$RUN_ID" >> "$GITHUB_ENV"
134-
echo "TMP_ROOT=${{ env.TMP_ROOT }}" >> "$GITHUB_ENV"
135-
mkdir -p "${{ env.TMP_ROOT }}/shared" "${{ env.TMP_ROOT }}/matrix-logs"
136-
137-
- name: Build parent kubeconfig from secret
138-
working-directory: ci/dvp-e2e
139-
run: |
140-
KCFG="$HOME/.kube/config"
141-
task parent:kubeconfig OUTPUT="$KCFG" API_URL="${E2E_K8S_URL}" SA_TOKEN="${{ secrets.E2E_NESTED_SA_SECRET }}"
142-
echo "KUBECONFIG=$KCFG" >> "$GITHUB_ENV"
143-
144-
- name: Prepare run values.yaml
96+
- name: Setup nested environment
97+
env:
98+
RUN_ID: ${{ env.RUN_ID }}
99+
PROFILE: ${{ env.PROFILE }}
100+
STORAGE_CLASS: ${{ env.STORAGE_CLASS }}
101+
PARENT_STORAGE_CLASS: ${{ env.PARENT_STORAGE_CLASS }}
102+
IMAGE_STORAGE_CLASS: ${{ env.IMAGE_STORAGE_CLASS }}
103+
ATTACH_DISK_SIZE: ${{ env.ATTACH_DISK_SIZE }}
104+
DATA_DISK_COUNT: ${{ env.DATA_DISK_COUNT }}
105+
REGISTRY_DOCKER_CFG: ${{ secrets.DEV_REGISTRY_DOCKER_CFG }}
106+
API_URL: ${{ env.E2E_K8S_URL }}
107+
SA_TOKEN: ${{ secrets.E2E_NESTED_SA_SECRET }}
145108
working-directory: ci/dvp-e2e
146109
run: |
147-
task run:values:prepare \
148-
RUN_ID="${{ env.RUN_ID }}" \
149-
RUN_NAMESPACE="${{ env.RUN_ID }}" \
150-
RUN_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}"
151-
152-
- name: Configure registry auth for installer pull
153-
run: |
154-
mkdir -p ~/.docker
155-
printf '%s' "$REGISTRY_DOCKER_CFG" | base64 -d > ~/.docker/config.json
156-
157-
- name: Configure storage profile
158-
working-directory: ci/dvp-e2e
159-
id: profile-config
160-
run: |
161-
PROFILE_JSON=$(jq -c --arg profile "$PROFILE" '.[] | select(.name == $profile)' profiles.json)
162-
if [ -z "$PROFILE_JSON" ]; then
163-
echo "Profile '$PROFILE' not found in profiles.json" >&2
164-
echo "Available profiles:" >&2
165-
jq -r '.[] | " - \(.name)"' profiles.json >&2
166-
exit 1
167-
fi
168-
169-
STORAGE_CLASS=$(jq -r '.storage_class // ""' <<<"$PROFILE_JSON")
170-
IMAGE_STORAGE_CLASS=$(jq -r '.image_storage_class // ""' <<<"$PROFILE_JSON")
171-
SNAPSHOT_STORAGE_CLASS=$(jq -r '.snapshot_storage_class // ""' <<<"$PROFILE_JSON")
172-
PARENT_STORAGE_CLASS=$(jq -r '.parent_storage_class // ""' <<<"$PROFILE_JSON")
173-
ATTACH_DISK_SIZE=$(jq -r '.worker_data_disk_size // "10Gi"' <<<"$PROFILE_JSON")
174-
175-
echo "Profile: ${PROFILE}"
176-
echo "Storage Class: ${STORAGE_CLASS}"
177-
echo "Image Storage Class: ${IMAGE_STORAGE_CLASS}"
178-
echo "Snapshot Storage Class: ${SNAPSHOT_STORAGE_CLASS}"
179-
echo "Parent Storage Class: ${PARENT_STORAGE_CLASS}"
180-
echo "Attach Disk Size: ${ATTACH_DISK_SIZE}"
181-
182-
# Export variables to GitHub Actions environment
183-
echo "STORAGE_CLASS=${STORAGE_CLASS}" >> $GITHUB_ENV
184-
echo "PARENT_STORAGE_CLASS=${PARENT_STORAGE_CLASS}" >> $GITHUB_ENV
185-
echo "ATTACH_DISK_SIZE=${ATTACH_DISK_SIZE}" >> $GITHUB_ENV
186-
# Pass storage profile into run values for Helm templates
187-
yq eval --inplace ".storageProfile = \"${PROFILE}\"" "${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml"
188-
# Effective disk SC used for worker data disks (prefer image SC when set)
189-
EFF_DISK_SC=${IMAGE_STORAGE_CLASS:-$STORAGE_CLASS}
190-
echo "EFFECTIVE_DISK_SC=${EFF_DISK_SC}" >> $GITHUB_ENV
191-
192-
- name: Install nested environment
193-
working-directory: ci/dvp-e2e
194-
run: |
195-
task install:nested:env \
196-
TMP_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}" \
197-
VALUES_FILE="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" \
198-
PARENT_KUBECONFIG="${KUBECONFIG}" \
199-
TARGET_STORAGE_CLASS="${{ env.PARENT_STORAGE_CLASS }}" \
200-
ATTACH_DISK_SIZE="${{ env.ATTACH_DISK_SIZE }}" \
201-
EFFECTIVE_DISK_SC="${{ env.EFFECTIVE_DISK_SC }}" \
202-
NAMESPACE="${{ env.RUN_ID }}" \
203-
NESTED_KUBECONFIG="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/nested/kubeconfig" \
204-
SDS_SC_NAME="${{ env.STORAGE_CLASS }}"
110+
task ci:setup-nested-env
205111
206112
cleanup:
207-
name: Cleanup [skeleton]
208-
needs: [setup-nested-envs, prepare]
113+
name: Cleanup (${{ matrix.profile }})
114+
needs: setup
209115
if: always()
210116
runs-on: ubuntu-latest
117+
strategy:
118+
matrix:
119+
include:
120+
- profile: sds-replicated-volume
121+
storage_name: sds
122+
storage_class: linstor-thin-r2
123+
parent_storage_class: linstor-thin-r1-immediate
124+
image_storage_class: linstor-thin-r1-immediate
125+
attach_disk_size: 10Gi
126+
data_disk_count: 2
211127
env:
212128
CLEANUP_PREFIX: ${{ vars.CLEANUP_PREFIX || 'nightly-nested-e2e-' }}
213129
steps:
214130
- uses: actions/checkout@v4
215131

132+
- name: Install Task
133+
uses: arduino/setup-task@v2
134+
with:
135+
version: 3.x
136+
216137
- name: Install kubectl
217138
uses: azure/setup-kubectl@v4
218139
with:
219140
version: "latest"
220141

221-
- name: Install Task
222-
uses: arduino/setup-task@v2
223-
224-
- name: Build parent kubeconfig from secret
225-
working-directory: ci/dvp-e2e
226-
run: |
227-
KCFG="$HOME/.kube/config"
228-
task parent:kubeconfig OUTPUT="$KCFG" API_URL="${E2E_K8S_URL}" SA_TOKEN="${{ secrets.E2E_NESTED_SA_SECRET }}"
229-
echo "KUBECONFIG=$KCFG" >> "$GITHUB_ENV"
230-
231142
- name: Cleanup test namespaces
232143
working-directory: ci/dvp-e2e
233144
run: |
234-
task cleanup:namespaces PREFIX="${CLEANUP_PREFIX}" PARENT_KUBECONFIG="${KUBECONFIG}"
235-
236-
- name: Report cleanup results
237-
if: always()
238-
run: |
239-
echo "### Cleanup Results" >> $GITHUB_STEP_SUMMARY
240-
echo "✅ Cleanup job completed" >> $GITHUB_STEP_SUMMARY
241-
echo "🧹 Attempted to clean up namespaces with prefix '${CLEANUP_PREFIX}'" >> $GITHUB_STEP_SUMMARY
145+
task cleanup:namespaces \
146+
PREFIX="${CLEANUP_PREFIX}" \
147+
API_URL="${E2E_K8S_URL}" \
148+
SA_TOKEN="${{ secrets.E2E_NESTED_SA_SECRET }}"

0 commit comments

Comments
 (0)