Skip to content

Commit a03cd85

Browse files
committed
chore(ci): refactor E2E workflow and Taskfile
- Remove duplicates: kubeconfig in cleanup, run_id outputs, Install Task - Remove hardcoded storage class values, use profile variables - Simplify REGISTRY_DOCKER_CFG usage (direct secret access) - Remove USE_GH_SSH_KEYS variable (always import from GitHub) - Remove fetch-depth: 0 (unused) - Remove unused nfs config from cluster-config/values - Add profile to setup-nested-envs outputs - Replace d8 installation with werf/trdl/actions/[email protected] - Remove PASSWORD_FILE variable (local only) - Change default SSH_FILE_NAME to id_ed - Create unified task install:nested:env for complete setup - Add Docker registry auth via config.json - Ensure nested dir exists before creating kubeconfig
1 parent 43f0699 commit a03cd85

File tree

12 files changed

+663
-843
lines changed

12 files changed

+663
-843
lines changed

.github/workflows/e2e-matrix.yml

Lines changed: 47 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ on:
2626
schedule:
2727
- cron: "30 2 * * *"
2828
workflow_dispatch:
29-
inputs:
30-
timeout:
31-
description: "Ginkgo timeout (e.g. 2h, 4h)"
32-
required: false
33-
default: "4h"
3429

3530
permissions:
3631
contents: read
@@ -52,10 +47,9 @@ jobs:
5247
concurrency:
5348
group: setup-nested-envs-${{ github.head_ref || github.ref_name }}
5449
cancel-in-progress: true
55-
env:
56-
PROFILE: sds-replicated-volume
5750
outputs:
5851
run_id: ${{ steps.prep.outputs.run_id }}
52+
profile: ${{ steps.load.outputs.profile }}
5953
steps:
6054
- uses: actions/checkout@v4
6155

@@ -72,11 +66,14 @@ jobs:
7266
id: prep
7367
run: |
7468
RUN_ID="nightly-nested-e2e-sds-$(date +%H%M%S)"
69+
PROFILE="${{ steps.load.outputs.profile }}"
7570
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
7671
mkdir -p ./tmp/run-context
77-
echo "profile: ${PROFILE}" > ./tmp/run-context/config.yaml
78-
echo "run_id: ${RUN_ID}" >> ./tmp/run-context/config.yaml
79-
echo "timestamp: $(date -Iseconds)" >> ./tmp/run-context/config.yaml
72+
{
73+
echo "profile: ${PROFILE}"
74+
echo "run_id: ${RUN_ID}"
75+
echo "timestamp: $(date -Iseconds)"
76+
} > ./tmp/run-context/config.yaml
8077
8178
- name: Upload run context
8279
uses: actions/upload-artifact@v4
@@ -93,24 +90,15 @@ jobs:
9390
runs-on: ubuntu-latest
9491
timeout-minutes: 300
9592
concurrency:
96-
group: prepare-${{ github.head_ref || github.ref_name }}-sds-replicated-volume
93+
group: prepare-${{ github.head_ref || github.ref_name }}-${{ needs.setup-nested-envs.outputs.profile }}
9794
cancel-in-progress: true
9895
env:
99-
PROFILE: sds-replicated-volume
100-
GO_VERSION: "1.24.6"
96+
PROFILE: ${{ needs.setup-nested-envs.outputs.profile }}
10197
TMP_ROOT: ${{ github.workspace }}/ci/dvp-e2e/tmp
102-
103-
outputs:
104-
run_id: ${{ steps.prep.outputs.run_id }}
105-
storage_class: ${{ steps.profile-config.outputs.storage_class }}
106-
image_storage_class: ${{ steps.profile-config.outputs.image_storage_class }}
107-
snapshot_storage_class: ${{ steps.profile-config.outputs.snapshot_storage_class }}
108-
attach_disk_size: ${{ steps.profile-config.outputs.attach_disk_size }}
98+
REGISTRY_DOCKER_CFG: ${{ secrets.DEV_REGISTRY_DOCKER_CFG }}
10999

110100
steps:
111101
- uses: actions/checkout@v4
112-
with:
113-
fetch-depth: 0
114102

115103
- name: Install Task
116104
uses: arduino/setup-task@v2
@@ -128,18 +116,15 @@ jobs:
128116
with:
129117
version: "latest"
130118

131-
- name: Install Deckhouse CLI
132-
env:
133-
D8_VERSION: v0.13.2
134-
run: |
135-
set -euo pipefail
136-
echo "Installing d8 ${D8_VERSION}..."
137-
curl -fsSL -o d8.tgz "https://deckhouse.io/downloads/deckhouse-cli/${D8_VERSION}/d8-${D8_VERSION}-linux-amd64.tar.gz"
138-
tar -xzf d8.tgz linux-amd64/bin/d8
139-
mv linux-amd64/bin/d8 /usr/local/bin/d8
140-
chmod +x /usr/local/bin/d8
141-
rm -rf d8.tgz linux-amd64
142-
d8 --version
119+
- name: Setup d8
120+
uses: werf/trdl/actions/[email protected]
121+
with:
122+
repo: d8
123+
url: https://deckhouse.ru/downloads/deckhouse-cli-trdl/
124+
root-version: 1
125+
root-sha512: 343bd5f0d8811254e5f0b6fe292372a7b7eda08d276ff255229200f84e58a8151ab2729df3515cb11372dc3899c70df172a4e54c8a596a73d67ae790466a0491
126+
group: 0
127+
channel: stable
143128

144129
- name: Install yq
145130
run: |
@@ -157,9 +142,7 @@ jobs:
157142
id: prep
158143
run: |
159144
RUN_ID="${{ needs.setup-nested-envs.outputs.run_id }}"
160-
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
161145
echo "RUN_ID=$RUN_ID" >> "$GITHUB_ENV"
162-
echo "PROFILE=sds-replicated-volume" >> "$GITHUB_ENV"
163146
echo "TMP_ROOT=${{ env.TMP_ROOT }}" >> "$GITHUB_ENV"
164147
mkdir -p "${{ env.TMP_ROOT }}/shared" "${{ env.TMP_ROOT }}/matrix-logs"
165148
@@ -177,56 +160,29 @@ jobs:
177160
RUN_ID="${{ env.RUN_ID }}" \
178161
RUN_NAMESPACE="${{ env.RUN_ID }}" \
179162
RUN_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}"
180-
echo "VALUES_TEMPLATE_FILE=${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" >> $GITHUB_ENV
181-
182-
- name: Configure registry auth (DEV_REGISTRY_DOCKER_CFG)
183-
run: |
184-
dev_cfg_b64='${{ secrets.DEV_REGISTRY_DOCKER_CFG }}'
185-
if [ -n "$dev_cfg_b64" ]; then
186-
echo "::add-mask::$dev_cfg_b64"
187-
echo "REGISTRY_DOCKER_CFG=$dev_cfg_b64" >> "$GITHUB_ENV"
188-
else
189-
echo "[WARN] DEV_REGISTRY_DOCKER_CFG is empty; proceeding without registry cfg"
190-
fi
191-
192-
- name: Inject REGISTRY_DOCKER_CFG into values.yaml
193-
if: ${{ env.REGISTRY_DOCKER_CFG != '' }}
194-
working-directory: ci/dvp-e2e
195-
run: |
196-
VALS="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml"
197-
task values:inject-registry VALUES_FILE="$VALS" REGISTRY_DOCKER_CFG="${REGISTRY_DOCKER_CFG}"
198163
199-
- name: Docker login from DEV_REGISTRY_DOCKER_CFG (optional)
200-
if: ${{ env.REGISTRY_DOCKER_CFG != '' }}
164+
- name: Configure registry auth for installer pull
201165
run: |
202-
set -euo pipefail
203-
cfg=$(printf '%s' "$REGISTRY_DOCKER_CFG" | base64 -d)
204-
reg_list=$(printf '%s' "$cfg" | jq -r '.auths | keys[]')
205-
for reg in $reg_list; do
206-
auth=$(printf '%s' "$cfg" | jq -r --arg r "$reg" '.auths[$r].auth // ""')
207-
[ -z "$auth" ] && continue
208-
creds=$(printf '%s' "$auth" | base64 -d)
209-
user=${creds%%:*}
210-
pass=${creds#*:}
211-
echo "Logging into $reg"
212-
echo "$pass" | docker login "$reg" -u "$user" --password-stdin
213-
done
166+
mkdir -p ~/.docker
167+
printf '%s' "$REGISTRY_DOCKER_CFG" | base64 -d > ~/.docker/config.json
214168
215169
- name: Configure storage profile
216170
working-directory: ci/dvp-e2e
217171
id: profile-config
218-
env:
219-
PROFILE: sds-replicated-volume
220172
run: |
221-
# Get storage class configuration from profiles.json
222-
PROFILE_CONFIG=$(./scripts/get_profile_config.sh "${PROFILE}")
173+
PROFILE_JSON=$(jq -c --arg profile "$PROFILE" '.[] | select(.name == $profile)' profiles.json)
174+
if [ -z "$PROFILE_JSON" ]; then
175+
echo "Profile '$PROFILE' not found in profiles.json" >&2
176+
echo "Available profiles:" >&2
177+
jq -r '.[] | " - \(.name)"' profiles.json >&2
178+
exit 1
179+
fi
223180
224-
# Parse the output more carefully
225-
STORAGE_CLASS=$(echo "$PROFILE_CONFIG" | grep "^STORAGE_CLASS=" | cut -d'=' -f2)
226-
IMAGE_STORAGE_CLASS=$(echo "$PROFILE_CONFIG" | grep "^IMAGE_STORAGE_CLASS=" | cut -d'=' -f2)
227-
SNAPSHOT_STORAGE_CLASS=$(echo "$PROFILE_CONFIG" | grep "^SNAPSHOT_STORAGE_CLASS=" | cut -d'=' -f2)
228-
PARENT_STORAGE_CLASS=$(echo "$PROFILE_CONFIG" | grep "^PARENT_STORAGE_CLASS=" | cut -d'=' -f2)
229-
ATTACH_DISK_SIZE=$(echo "$PROFILE_CONFIG" | grep "^ATTACH_DISK_SIZE=" | cut -d'=' -f2)
181+
STORAGE_CLASS=$(jq -r '.storage_class // ""' <<<"$PROFILE_JSON")
182+
IMAGE_STORAGE_CLASS=$(jq -r '.image_storage_class // ""' <<<"$PROFILE_JSON")
183+
SNAPSHOT_STORAGE_CLASS=$(jq -r '.snapshot_storage_class // ""' <<<"$PROFILE_JSON")
184+
PARENT_STORAGE_CLASS=$(jq -r '.parent_storage_class // ""' <<<"$PROFILE_JSON")
185+
ATTACH_DISK_SIZE=$(jq -r '.worker_data_disk_size // "10Gi"' <<<"$PROFILE_JSON")
230186
231187
echo "Profile: ${PROFILE}"
232188
echo "Storage Class: ${STORAGE_CLASS}"
@@ -235,79 +191,29 @@ jobs:
235191
echo "Parent Storage Class: ${PARENT_STORAGE_CLASS}"
236192
echo "Attach Disk Size: ${ATTACH_DISK_SIZE}"
237193
238-
# Export variables to GitHub Actions environment and outputs
194+
# Export variables to GitHub Actions environment
239195
echo "STORAGE_CLASS=${STORAGE_CLASS}" >> $GITHUB_ENV
240-
echo "IMAGE_STORAGE_CLASS=${IMAGE_STORAGE_CLASS}" >> $GITHUB_ENV
241-
echo "SNAPSHOT_STORAGE_CLASS=${SNAPSHOT_STORAGE_CLASS}" >> $GITHUB_ENV
242196
echo "PARENT_STORAGE_CLASS=${PARENT_STORAGE_CLASS}" >> $GITHUB_ENV
243197
echo "ATTACH_DISK_SIZE=${ATTACH_DISK_SIZE}" >> $GITHUB_ENV
244-
echo "storage_class=$STORAGE_CLASS" >> $GITHUB_OUTPUT
245-
echo "image_storage_class=$IMAGE_STORAGE_CLASS" >> $GITHUB_OUTPUT
246-
echo "snapshot_storage_class=$SNAPSHOT_STORAGE_CLASS" >> $GITHUB_OUTPUT
247-
echo "attach_disk_size=$ATTACH_DISK_SIZE" >> $GITHUB_OUTPUT
248198
# Pass storage profile into run values for Helm templates
249199
yq eval --inplace ".storageProfile = \"${PROFILE}\"" "${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml"
250200
# Effective disk SC used for worker data disks (prefer image SC when set)
251201
EFF_DISK_SC=${IMAGE_STORAGE_CLASS:-$STORAGE_CLASS}
252202
echo "EFFECTIVE_DISK_SC=${EFF_DISK_SC}" >> $GITHUB_ENV
253203
254-
- name: Install infra (namespace/RBAC/ingress)
255-
working-directory: ci/dvp-e2e
256-
run: |
257-
USE_GH_SSH_KEYS=true SSH_FILE_NAME=id_ed task render-infra \
258-
TMP_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}" \
259-
VALUES_FILE="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" \
260-
PARENT_KUBECONFIG="${KUBECONFIG}" \
261-
SSH_FILE_NAME="id_ed"
262-
USE_GH_SSH_KEYS=true SSH_FILE_NAME=id_ed task infra-deploy \
263-
TMP_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}" \
264-
VALUES_FILE="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" \
265-
PARENT_KUBECONFIG="${KUBECONFIG}" \
266-
SSH_FILE_NAME="id_ed"
267-
268-
- name: Bootstrap nested cluster (via jump-host)
269-
working-directory: ci/dvp-e2e
270-
run: |
271-
echo "🚀 dhctl bootstrap (profile: sds-replicated-volume)"
272-
task dhctl-bootstrap \
273-
TMP_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}" \
274-
VALUES_FILE="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" \
275-
PARENT_KUBECONFIG="${KUBECONFIG}" \
276-
SSH_FILE_NAME="id_ed" \
277-
TARGET_STORAGE_CLASS="${{ env.PARENT_STORAGE_CLASS }}"
278-
279-
- name: Attach data disks to worker VMs using hotplug
204+
- name: Install nested environment
280205
working-directory: ci/dvp-e2e
281206
run: |
282-
task infra:attach-storage-disks-hotplug \
207+
task install:nested:env \
283208
TMP_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}" \
284209
VALUES_FILE="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" \
285210
PARENT_KUBECONFIG="${KUBECONFIG}" \
286-
DISK_SIZE="${ATTACH_DISK_SIZE:-10Gi}" \
287-
STORAGE_CLASS="ceph-pool-r2-csi-rbd-immediate" \
288-
DISK_COUNT="2"
289-
290-
- name: Build nested kubeconfig
291-
working-directory: ci/dvp-e2e
292-
run: |
293-
task nested:kubeconfig \
294-
TMP_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}" \
295-
VALUES_FILE="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" \
211+
TARGET_STORAGE_CLASS="${{ env.PARENT_STORAGE_CLASS }}" \
212+
ATTACH_DISK_SIZE="${{ env.ATTACH_DISK_SIZE }}" \
213+
EFFECTIVE_DISK_SC="${{ env.EFFECTIVE_DISK_SC }}" \
296214
NAMESPACE="${{ env.RUN_ID }}" \
297-
SSH_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/ssh" \
298-
SSH_FILE_NAME="id_ed" \
299-
NESTED_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/nested" \
300215
NESTED_KUBECONFIG="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/nested/kubeconfig" \
301-
PARENT_KUBECONFIG="${KUBECONFIG}"
302-
303-
- name: Configure SDS in nested cluster
304-
working-directory: ci/dvp-e2e
305-
run: |
306-
echo "💾 Configuring SDS storage (sds-node-configurator + sds-replicated-volume)"
307-
task nested:storage:sds \
308-
TMP_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}" \
309-
NESTED_KUBECONFIG="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/nested/kubeconfig" \
310-
SDS_SC_NAME="${{ steps.profile-config.outputs.storage_class }}"
216+
SDS_SC_NAME="${{ env.STORAGE_CLASS }}"
311217
312218
- name: Upload run context
313219
if: always()
@@ -325,34 +231,28 @@ jobs:
325231
needs: [setup-nested-envs, prepare]
326232
if: always()
327233
runs-on: ubuntu-latest
234+
env:
235+
CLEANUP_PREFIX: ${{ vars.CLEANUP_PREFIX || 'nightly-nested-e2e-' }}
328236
steps:
329237
- uses: actions/checkout@v4
330238

331-
- name: Install Task
332-
uses: arduino/setup-task@v2
333-
with:
334-
version: 3.x
335-
repo-token: ${{ secrets.GITHUB_TOKEN }}
336-
337239
- name: Install kubectl
338240
uses: azure/setup-kubectl@v4
339241
with:
340242
version: "latest"
341243

342-
- name: Build parent kubeconfig from secret (cleanup)
244+
- name: Install Task
245+
uses: arduino/setup-task@v2
246+
247+
- name: Build parent kubeconfig from secret
343248
working-directory: ci/dvp-e2e
344249
run: |
345250
KCFG="$HOME/.kube/config"
346251
task parent:kubeconfig OUTPUT="$KCFG" API_URL="${E2E_K8S_URL}" SA_TOKEN="${{ secrets.E2E_NESTED_SA_SECRET }}"
347252
echo "KUBECONFIG=$KCFG" >> "$GITHUB_ENV"
348253
349-
- name: Install Task
350-
uses: arduino/setup-task@v2
351-
352254
- name: Cleanup test namespaces
353255
working-directory: ci/dvp-e2e
354-
env:
355-
CLEANUP_PREFIX: ${{ vars.CLEANUP_PREFIX || 'nightly-nested-e2e-' }}
356256
run: |
357257
task cleanup:namespaces PREFIX="${CLEANUP_PREFIX}" PARENT_KUBECONFIG="${KUBECONFIG}"
358258

0 commit comments

Comments
 (0)