Improve audit diffs and gate image releases on main CI
Test / test (push) Failing after 3m43s

This commit is contained in:
bryanpedini committed 2026-11-20 18:43:07 +01:00
1 parent 65d16c2fc6
commit 32a0cf6801
6 files changed
+207 -39

No files matched your search

+39 -18
View File
@@ -11,6 +11,9 @@ concurrency:
jobs:
image:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
env:
CI_IMAGE: coredns-web-ui:ci-${{ github.run_id }}-${{ github.run_attempt }}
steps:
@@ -25,17 +28,43 @@ jobs:
printf '%s\n' "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$' || { echo "::error::tag $GITHUB_REF_NAME is not a semantic version" >&2; exit 1; }
echo "version=$version" >> "$GITHUB_OUTPUT"
case $version in *-*) echo latest=false ;; *) echo latest=true ;; esac >> "$GITHUB_OUTPUT"
- name: Test
- name: Wait for CI on main
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
set -eu
docker build --pull --target test --output type=cacheonly -f dockerfile .
for database in mysql:5.7 mysql:8.4 mariadb:10.11; do
echo "Running integration tests against $database"
MYSQL_IMAGE="$database" IT_ID="${GITHUB_RUN_ID}" scripts/integration.sh
commit=$(git rev-parse HEAD)
url="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/workflows/test.yaml/runs"
deadline=$((SECONDS + 1800))
registration_deadline=$((SECONDS + 120))
while (( SECONDS < deadline )); do
response=$(curl --fail --silent --show-error --max-time 20 --retry 2 \
--header "Authorization: Bearer ${GITEA_TOKEN:?missing Gitea job token}" \
"$url?branch=main&event=push&head_sha=$commit&limit=1")
run=$(jq -c --arg sha "$commit" '
.workflow_runs | map(select(.head_branch == "main" and .event == "push" and .head_sha == $sha)) | first // empty
' <<< "$response")
if [ -z "$run" ]; then
if (( SECONDS >= registration_deadline )); then
echo "No push CI run on main for $commit" >&2
exit 1
fi
else
status=$(jq -r '.status' <<< "$run")
conclusion=$(jq -r '.conclusion // ""' <<< "$run")
run_url=$(jq -r '.html_url' <<< "$run")
echo "Main CI for $commit: $status ${conclusion} ($run_url)"
case "$status:$conclusion" in
completed:success) exit 0 ;;
requested:|pending:|queued:|waiting:|in_progress:) ;;
*) exit 1 ;;
esac
fi
sleep 15
done
echo "Running integration tests against MariaDB Galera"
IT_GALERA=1 MYSQL_IMAGE=mariadb:10.11.3 IT_ID="${GITHUB_RUN_ID}" scripts/integration.sh
- name: Build and test image
echo "Timed out waiting for main CI for $commit" >&2
exit 1
- name: Build image
id: build
env:
VERSION: ${{ steps.version.outputs.version }}
@@ -45,18 +74,10 @@ jobs:
echo "::error::local image tag already exists: $CI_IMAGE" >&2
exit 1
fi
commit=${GITHUB_SHA:0:12}
commit=$(git rev-parse HEAD)
commit=${commit:0:12}
docker build --build-arg APP_VERSION="$VERSION" --build-arg COMMIT_ID="$commit" -f dockerfile -t "$CI_IMAGE" .
printf 'image_id=%s\n' "$(docker image inspect --format '{{.Id}}' "$CI_IMAGE")" >> "$GITHUB_OUTPUT"
scripts/test-image.sh "$CI_IMAGE" "$VERSION" "$commit"
scripts/test-e2e.sh "$CI_IMAGE"
- name: Save accessibility screenshots
if: always()
uses: actions/upload-artifact@v3
with:
name: accessibility-screenshots
path: e2e/reports/**/screenshots/*.png
if-no-files-found: warn
- name: Publish image
env:
GIT_HOST: ${{ vars.GIT_HOST }}