Skip to content

Commit 22b75f5

Browse files
committed
ci(e2e): workflow fixes and cleanups for SDS-only PR
- use DEV_REGISTRY_DOCKER_CFG only; inject into values; login via docker cfg - fix GitHub Actions 'if' expressions (no secrets.* in if; use env) - add Apache-2.0 headers to helper scripts (dmtlint) - format ci/dvp-e2e/Taskfile.yaml with repo Prettier (prettier) - trim push triggers to ci-e2e-nested-sds only; remove noisy comments - keep setup/prepare/cleanup only (tests/report moved to next PR) Signed-off-by: Anton Yachmenev <[email protected]>
1 parent bc0e586 commit 22b75f5

File tree

4 files changed

+53
-35
lines changed

4 files changed

+53
-35
lines changed

.github/workflows/e2e-matrix.yml

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
push:
1919
branches:
2020
- chore/ci/e2e-matrix-skeleton
21+
- ci-e2e-nested-sds
2122
pull_request:
2223
types: [opened, reopened, synchronize, labeled, unlabeled]
2324
branches:
@@ -180,47 +181,39 @@ jobs:
180181
RUN_DIR="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}"
181182
echo "VALUES_TEMPLATE_FILE=${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml" >> $GITHUB_ENV
182183
183-
- name: Configure registry auth (REGISTRY_DOCKER_CFG)
184+
- name: Configure registry auth (DEV_REGISTRY_DOCKER_CFG)
184185
run: |
185-
prod_user="${{ secrets.PROD_READ_REGISTRY_USER }}"
186-
prod_pass="${{ secrets.PROD_READ_REGISTRY_PASSWORD }}"
187-
dev_user="${{ secrets.BOOTSTRAP_DEV_REGISTRY_LOGIN }}"
188-
dev_pass="${{ secrets.BOOTSTRAP_DEV_REGISTRY_PASSWORD }}"
189-
echo "::add-mask::$prod_user"
190-
echo "::add-mask::$prod_pass"
191-
echo "::add-mask::$dev_user"
192-
echo "::add-mask::$dev_pass"
193-
prod_auth_b64=$(printf '%s:%s' "$prod_user" "$prod_pass" | base64 | tr -d '\n')
194-
dev_auth_b64=$(printf '%s:%s' "$dev_user" "$dev_pass" | base64 | tr -d '\n')
195-
docker_cfg=$(printf '{"auths":{"registry.deckhouse.io":{"auth":"%s"},"dev-registry.deckhouse.io":{"auth":"%s"}}}' "$prod_auth_b64" "$dev_auth_b64")
196-
docker_cfg_b64=$(printf '%s' "$docker_cfg" | base64 | tr -d '\n')
197-
echo "::add-mask::$docker_cfg_b64"
198-
{
199-
echo "REGISTRY_DOCKER_CFG=$docker_cfg_b64"
200-
echo "DECKHOUSE_REGISTRY_USER=$prod_user"
201-
echo "DECKHOUSE_REGISTRY_PASSWORD=$prod_pass"
202-
} >> "$GITHUB_ENV"
186+
dev_cfg_b64='${{ secrets.DEV_REGISTRY_DOCKER_CFG }}'
187+
if [ -n "$dev_cfg_b64" ]; then
188+
echo "::add-mask::$dev_cfg_b64"
189+
echo "REGISTRY_DOCKER_CFG=$dev_cfg_b64" >> "$GITHUB_ENV"
190+
else
191+
echo "[WARN] DEV_REGISTRY_DOCKER_CFG is empty; proceeding without registry cfg"
192+
fi
203193
204194
- name: Inject REGISTRY_DOCKER_CFG into values.yaml
195+
if: ${{ env.REGISTRY_DOCKER_CFG != '' }}
205196
working-directory: ci/dvp-e2e
206197
run: |
207198
chmod +x scripts/inject_registry_cfg.sh
208199
VALS="${{ env.TMP_ROOT }}/runs/${{ env.RUN_ID }}/values.yaml"
209200
REGISTRY_DOCKER_CFG="${REGISTRY_DOCKER_CFG}" scripts/inject_registry_cfg.sh -f "$VALS" -v "$REGISTRY_DOCKER_CFG"
210201
211-
- name: Docker login to Deckhouse registry
212-
uses: docker/login-action@v3
213-
with:
214-
registry: registry.deckhouse.io
215-
username: ${{ env.DECKHOUSE_REGISTRY_USER }}
216-
password: ${{ env.DECKHOUSE_REGISTRY_PASSWORD }}
217-
218-
- name: Docker login to dev-registry
219-
uses: docker/login-action@v3
220-
with:
221-
registry: ${{ vars.DEV_REGISTRY }}
222-
username: ${{ secrets.BOOTSTRAP_DEV_REGISTRY_LOGIN }}
223-
password: ${{ secrets.BOOTSTRAP_DEV_REGISTRY_PASSWORD }}
202+
- name: Docker login from DEV_REGISTRY_DOCKER_CFG (optional)
203+
if: ${{ secrets.DEV_REGISTRY_DOCKER_CFG != '' }}
204+
run: |
205+
set -euo pipefail
206+
cfg=$(printf '%s' '${{ secrets.DEV_REGISTRY_DOCKER_CFG }}' | base64 -d)
207+
reg_list=$(printf '%s' "$cfg" | jq -r '.auths | keys[]')
208+
for reg in $reg_list; do
209+
auth=$(printf '%s' "$cfg" | jq -r --arg r "$reg" '.auths[$r].auth // ""')
210+
[ -z "$auth" ] && continue
211+
creds=$(printf '%s' "$auth" | base64 -d)
212+
user=${creds%%:*}
213+
pass=${creds#*:}
214+
echo "Logging into $reg"
215+
echo "$pass" | docker login "$reg" -u "$user" --password-stdin
216+
done
224217
225218
- name: Configure storage profile
226219
working-directory: ci/dvp-e2e

ci/dvp-e2e/Taskfile.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,6 @@ tasks:
682682
task dhctl-bootstrap VALUES_FILE='{{ .VALUES_FILE }}' TMP_DIR='{{ .TMP_DIR }}' SSH_FILE_NAME='id_ed'
683683
} 2>&1 | tee '{{ .LOG_FILE }}'
684684
685-
686-
687685
# ------------------------------------------------------------
688686
# Nested cluster helpers (SC + kubeconfig)
689687
# ------------------------------------------------------------

ci/dvp-e2e/scripts/build_parent_kubeconfig.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/usr/bin/env bash
2+
3+
# Copyright 2025 Flant JSC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
216
set -euo pipefail
317

418
# Usage:
@@ -44,4 +58,3 @@ users:
4458
EOF
4559
chmod 600 "$out"
4660
echo "KUBECONFIG=$out"
47-

ci/dvp-e2e/scripts/inject_registry_cfg.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/usr/bin/env bash
2+
3+
# Copyright 2025 Flant JSC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
216
set -euo pipefail
317

418
# Usage:

0 commit comments

Comments
 (0)