|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -name: E2E Matrix Tests (Skeleton) |
| 15 | +name: E2E Storage Matrix |
16 | 16 |
|
17 | 17 | on: |
18 | 18 | push: |
|
30 | 30 | permissions: |
31 | 31 | contents: read |
32 | 32 |
|
33 | | -concurrency: |
34 | | - group: e2e-matrix-${{ github.head_ref || github.ref_name }} |
35 | | - cancel-in-progress: true |
36 | | - |
37 | 33 | env: |
38 | 34 | E2E_K8S_URL: https://api.e2e.virtlab.flant.com |
39 | 35 |
|
40 | 36 | 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 }}) |
84 | 39 | 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 |
86 | 50 | 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 }} |
88 | 52 | cancel-in-progress: true |
89 | 53 | 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 }} |
94 | 61 | steps: |
95 | 62 | - uses: actions/checkout@v4 |
96 | 63 |
|
@@ -126,116 +93,56 @@ jobs: |
126 | 93 | curl -L -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.44.1/yq_linux_amd64 |
127 | 94 | chmod +x /usr/local/bin/yq |
128 | 95 |
|
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 }} |
145 | 108 | working-directory: ci/dvp-e2e |
146 | 109 | 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 |
205 | 111 |
|
206 | 112 | cleanup: |
207 | | - name: Cleanup [skeleton] |
208 | | - needs: [setup-nested-envs, prepare] |
| 113 | + name: Cleanup (${{ matrix.profile }}) |
| 114 | + needs: setup |
209 | 115 | if: always() |
210 | 116 | 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 |
211 | 127 | env: |
212 | 128 | CLEANUP_PREFIX: ${{ vars.CLEANUP_PREFIX || 'nightly-nested-e2e-' }} |
213 | 129 | steps: |
214 | 130 | - uses: actions/checkout@v4 |
215 | 131 |
|
| 132 | + - name: Install Task |
| 133 | + uses: arduino/setup-task@v2 |
| 134 | + with: |
| 135 | + version: 3.x |
| 136 | + |
216 | 137 | - name: Install kubectl |
217 | 138 | uses: azure/setup-kubectl@v4 |
218 | 139 | with: |
219 | 140 | version: "latest" |
220 | 141 |
|
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 | | -
|
231 | 142 | - name: Cleanup test namespaces |
232 | 143 | working-directory: ci/dvp-e2e |
233 | 144 | 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