mirror of
https://github.com/dockur/windows.git
synced 2026-07-27 21:42:36 +07:00
Compare commits
8 Commits
57ed97f5e5
...
9e834ff359
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e834ff359 | |||
| fb320b06e8 | |||
| 5271489998 | |||
| dcfa51f337 | |||
| 0fc0ac30ec | |||
| b60e59a236 | |||
| 6301211c62 | |||
| 86631059fb |
+147
-27
@@ -19,10 +19,10 @@ on:
|
||||
default: ubuntu-24.04
|
||||
type: string
|
||||
|
||||
image:
|
||||
description: Container image to test
|
||||
branch:
|
||||
description: Repository branch to build
|
||||
required: false
|
||||
default: ghcr.io/dockur/windows:latest
|
||||
default: master
|
||||
type: string
|
||||
|
||||
callback:
|
||||
@@ -43,6 +43,12 @@ on:
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
kill_on_failure:
|
||||
description: Stop the workflow when an installation failure is detected
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
expected_caption:
|
||||
description: Text expected in the Windows caption
|
||||
required: true
|
||||
@@ -75,9 +81,15 @@ jobs:
|
||||
|
||||
env:
|
||||
CONTAINER: windows-test
|
||||
IMAGE: ${{ inputs.image }}
|
||||
IMAGE: windows-validation:local
|
||||
TUNNEL: windows-test-tunnel
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ inputs.branch }}
|
||||
|
||||
- name: Check KVM
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -462,28 +474,40 @@ jobs:
|
||||
|
||||
echo "token=$token" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Pull image
|
||||
- name: Build image
|
||||
shell: bash
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
|
||||
docker pull "$IMAGE"
|
||||
echo "Building branch: ${{ inputs.branch }}"
|
||||
echo "Commit: $(git rev-parse HEAD)"
|
||||
|
||||
for attempt in 1 2 3; do
|
||||
if docker build \
|
||||
--tag "$IMAGE" \
|
||||
.; then
|
||||
break
|
||||
fi
|
||||
|
||||
if (( attempt == 3 )); then
|
||||
echo "Image build failed after $attempt attempts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
delay=$((attempt * 15))
|
||||
echo "Image build failed, retrying in $delay seconds..."
|
||||
sleep "$delay"
|
||||
done
|
||||
|
||||
docker image inspect "$IMAGE" \
|
||||
--format 'Digest: {{index .RepoDigests 0}}'
|
||||
--format 'Image ID: {{.Id}}'
|
||||
|
||||
- name: Install and validate Windows
|
||||
- name: Start Windows container
|
||||
shell: bash
|
||||
env:
|
||||
CPU: ${{ inputs.cpu }}
|
||||
DISK_TYPE: ${{ inputs.disk_type }}
|
||||
EXPECTED_TOKEN: ${{ steps.test.outputs.token }}
|
||||
EXPECTED_CAPTION: ${{ inputs.expected_caption }}
|
||||
EXPECTED_EDITION: ${{ inputs.expected_edition }}
|
||||
EXPECTED_PLATFORM: ${{ inputs.platform }}
|
||||
MINIMUM_BUILD: ${{ inputs.minimum_build }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
DISPLAY_NAME: ${{ inputs.name }}
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
|
||||
@@ -493,6 +517,7 @@ jobs:
|
||||
--device /dev/net/tun \
|
||||
--cap-add NET_ADMIN \
|
||||
--stop-timeout 120 \
|
||||
--env "MACHINE=pc" \
|
||||
--env "VERSION=$VERSION" \
|
||||
--env "RAM_SIZE=half" \
|
||||
--env "CPU_CORES=half" \
|
||||
@@ -506,6 +531,67 @@ jobs:
|
||||
--volume "$RUNNER_TEMP/storage:/storage" \
|
||||
"$IMAGE"
|
||||
|
||||
- name: Start noVNC tunnel
|
||||
id: tunnel
|
||||
shell: bash
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
|
||||
if docker run --detach \
|
||||
--name "$TUNNEL" \
|
||||
--network "container:$CONTAINER" \
|
||||
cloudflare/cloudflared:latest \
|
||||
tunnel \
|
||||
--no-autoupdate \
|
||||
--url http://127.0.0.1:8006 > /dev/null 2>/dev/null; then
|
||||
novnc_url=""
|
||||
|
||||
for _ in {1..30}; do
|
||||
novnc_url="$(
|
||||
docker logs "$TUNNEL" 2>&1 |
|
||||
grep -Eo 'https://[-a-z0-9]+\.trycloudflare\.com' |
|
||||
tail -n 1 || true
|
||||
)"
|
||||
|
||||
[ -n "$novnc_url" ] && break
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ -n "$novnc_url" ]; then
|
||||
echo
|
||||
echo "::notice title=noVNC viewer::$novnc_url"
|
||||
echo "noVNC viewer: $novnc_url"
|
||||
echo "Warning: this temporary URL is publicly accessible."
|
||||
echo "url=$novnc_url" >> "$GITHUB_OUTPUT"
|
||||
|
||||
{
|
||||
echo "### noVNC viewer"
|
||||
echo
|
||||
echo "[$novnc_url]($novnc_url)"
|
||||
echo
|
||||
echo "> This temporary URL is publicly accessible while the job is running."
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
else
|
||||
echo "::warning::Failed to obtain a noVNC tunnel URL."
|
||||
docker logs "$TUNNEL" 2>&1 || true
|
||||
fi
|
||||
else
|
||||
echo "::warning::Failed to start the noVNC tunnel."
|
||||
fi
|
||||
|
||||
- name: Install and validate Windows
|
||||
shell: bash
|
||||
env:
|
||||
KILL_ON_FAILURE: ${{ inputs.kill_on_failure }}
|
||||
EXPECTED_TOKEN: ${{ steps.test.outputs.token }}
|
||||
EXPECTED_CAPTION: ${{ inputs.expected_caption }}
|
||||
EXPECTED_EDITION: ${{ inputs.expected_edition }}
|
||||
EXPECTED_PLATFORM: ${{ inputs.platform }}
|
||||
MINIMUM_BUILD: ${{ inputs.minimum_build }}
|
||||
DISPLAY_NAME: ${{ inputs.name }}
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo
|
||||
echo "Container log:"
|
||||
echo "------------------------------------------------------------"
|
||||
@@ -550,10 +636,27 @@ jobs:
|
||||
|
||||
trap stop_logs EXIT
|
||||
|
||||
failure_checks_disabled=0
|
||||
|
||||
handle_failure() {
|
||||
local message="$1"
|
||||
|
||||
if [[ "$KILL_ON_FAILURE" == "true" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Automatic termination is disabled by kill_on_failure."
|
||||
echo "The container and noVNC tunnel will remain available."
|
||||
echo "::warning title=Failure detected::$message"
|
||||
failure_checks_disabled=1
|
||||
return 0
|
||||
}
|
||||
|
||||
deadline=$((SECONDS + 9000))
|
||||
reboot_timeout=1800
|
||||
minimum_reboots=1
|
||||
boot_loop_limit=5
|
||||
boot_loop_limit=10
|
||||
first_bios_start=-1
|
||||
|
||||
while (( SECONDS < deadline )); do
|
||||
@@ -573,22 +676,30 @@ jobs:
|
||||
|
||||
container_log="$(docker logs "$CONTAINER" 2>&1 || true)"
|
||||
|
||||
if grep -Eqi \
|
||||
'KVM internal error|KVM: entry failed|hardware error 0x[0-9a-f]+|Triple fault' \
|
||||
<<< "$container_log"; then
|
||||
if (( failure_checks_disabled == 0 )) &&
|
||||
grep -Eqi \
|
||||
'KVM internal error|KVM: entry failed|hardware error 0x[0-9a-f]+|Triple fault' \
|
||||
<<< "$container_log"; then
|
||||
echo
|
||||
echo "------------------------------------------------------------"
|
||||
echo "Detected a fatal QEMU or KVM error."
|
||||
exit 1
|
||||
|
||||
if ! handle_failure "Detected a fatal QEMU or KVM error."; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -Eqi \
|
||||
'CDBOOT: Cannot boot from CD.*Code: 5' \
|
||||
<<< "$container_log"; then
|
||||
if (( failure_checks_disabled == 0 )) &&
|
||||
grep -Eqi \
|
||||
'CDBOOT: Cannot boot from CD.*Code: 5' \
|
||||
<<< "$container_log"; then
|
||||
echo
|
||||
echo "------------------------------------------------------------"
|
||||
echo "The installation media could not be booted."
|
||||
exit 1
|
||||
|
||||
if ! handle_failure "The installation media could not be booted."; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
bios_starts="$(
|
||||
@@ -629,7 +740,8 @@ jobs:
|
||||
first_bios_start=$SECONDS
|
||||
fi
|
||||
|
||||
if (( first_bios_start >= 0 &&
|
||||
if (( failure_checks_disabled == 0 &&
|
||||
first_bios_start >= 0 &&
|
||||
SECONDS - first_bios_start >= reboot_timeout &&
|
||||
reboots < minimum_reboots )); then
|
||||
echo
|
||||
@@ -638,10 +750,14 @@ jobs:
|
||||
"$((reboot_timeout / 60)) minutes after the first BIOS start."
|
||||
echo "Observed reboots: $reboots"
|
||||
echo "Required reboots: $minimum_reboots"
|
||||
exit 1
|
||||
|
||||
if ! handle_failure "The installation did not reboot in time."; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( bios_starts >= boot_loop_limit )) &&
|
||||
if (( failure_checks_disabled == 0 &&
|
||||
bios_starts >= boot_loop_limit )) &&
|
||||
(( hard_disk_boots >= boot_loop_limit ||
|
||||
dvd_boots >= boot_loop_limit ||
|
||||
not_bootable_disk >= boot_loop_limit ||
|
||||
@@ -658,7 +774,10 @@ jobs:
|
||||
echo "Unreadable boot-disk failures: $unreadable_boot_disk"
|
||||
echo "No-bootable-device failures: $no_bootable_device"
|
||||
echo "BOOTMGR failures: $bootmgr_missing"
|
||||
exit 1
|
||||
|
||||
if ! handle_failure "Detected a repeated BIOS boot loop."; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
response=""
|
||||
@@ -769,4 +888,5 @@ jobs:
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
docker rm --force "$TUNNEL" 2>/dev/null || true
|
||||
docker rm --force "$CONTAINER" 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user