Skip to content

fix(ci): fix run e2e if audit disabled #1048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/dev_module_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ on:
type: number
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
# == debug only ==
branches:
- main
- fix/ci/fix-run-e2e-with-audit
# ================
push:
branches:
- main
Expand Down
27 changes: 27 additions & 0 deletions tests/e2e/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,35 @@ tasks:
echo "Error: Deckhouse is not ready."
exit 1
fi

d8 k patch mpo virtualization --type merge -p "{\"spec\":{\"imageTag\":\"$v12n_tag\"}}"
images_hash=$(crane export "dev-registry.deckhouse.io/sys/deckhouse-oss/modules/virtualization:$v12n_tag" - | tar -Oxf - images_digests.json)

v12n_pods=$(kubectl -n d8-virtualization get pods -o json | jq -c)

audit_status=$(kubectl get mc virtualization -o=jsonpath='{.spec.settings.audit.enabled}')
audit_image_skip=$(if [ -z $audit_status ] || [ $audit_status == "false" ]; then echo "false";else echo "true";fi)

retry_count=0
max_retries=120
sleep_interval=5

if [ $audit_image_skip == "true" ]; then
SKIP_IMAGES=("virtualizationAudit")
fi

is_skipped_image() {
local img="$1"
if [ ${#img} -eq 0 ]; then return 1 ;fi

for skip in "${SKIP_IMAGES[@]}"; do
if [[ "$img" == "$skip" ]]; then
return 0 # image found in skip list
fi
done
return 1 # image not in skip list
}

while true; do
all_hashes_found=true

Expand All @@ -181,6 +203,11 @@ tasks:
continue
fi

if is_skipped_image "$image"; then
echo "- ⏭️ Skipping $image"
continue
fi

if echo "$v12n_pods" | grep -q "$hash"; then
echo "- ✅ $image $hash"
else
Expand Down
Loading