Add dedicated CI network isolation acceptance tests
ABSDEV Framework CI / framework-ci (push) Successful in 22s
ABSDEV Framework CI / framework-ci (push) Successful in 22s
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
name: Dedicated Runner Network Acceptance
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
network-acceptance:
|
||||
runs-on: absdev-ci
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- name: Verify protected network isolation
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
python3 - <<'PY'
|
||||
import socket
|
||||
import concurrent.futures
|
||||
|
||||
targets = [
|
||||
("PEGASUS gateway SSH", "192.168.150.1", 22),
|
||||
("PEGASUS gateway HTTPS", "192.168.150.1", 443),
|
||||
("PEGASUS Cockpit", "192.168.150.1", 9090),
|
||||
("PEGASUS LAN SSH", "192.168.1.2", 22),
|
||||
("PEGASUS MySQL", "192.168.1.2", 3306),
|
||||
("PEGASUS PostgreSQL", "192.168.1.2", 5432),
|
||||
("PEGASUS Redis", "192.168.1.2", 6379),
|
||||
("PEGASUS SFTP", "192.168.1.2", 2222),
|
||||
("PEGASUS rsync", "192.168.1.2", 2225),
|
||||
("Guest SSH via Docker bridge", "172.17.0.1", 22),
|
||||
("Guest SSH via guest IP", "192.168.150.10", 22),
|
||||
("PEGASUS public SSH", "51.194.132.189", 22),
|
||||
("PEGASUS public HTTPS", "51.194.132.189", 443),
|
||||
("ABSDEV public SSH", "217.154.36.101", 22),
|
||||
("ABSDEV public HTTPS", "217.154.36.101", 443),
|
||||
]
|
||||
|
||||
def probe(target):
|
||||
name, host, port = target
|
||||
|
||||
try:
|
||||
with socket.create_connection(
|
||||
(host, port), timeout=3
|
||||
):
|
||||
return name, False
|
||||
except OSError:
|
||||
return name, True
|
||||
|
||||
failures = []
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(
|
||||
max_workers=4
|
||||
) as executor:
|
||||
for name, blocked in executor.map(probe, targets):
|
||||
if blocked:
|
||||
print(f"PASS: {name} unavailable")
|
||||
else:
|
||||
print(f"FAIL: {name} reachable")
|
||||
failures.append(name)
|
||||
|
||||
if failures:
|
||||
raise SystemExit(1)
|
||||
|
||||
print(f"PASS: All {len(targets)} protected targets unavailable")
|
||||
PY
|
||||
|
||||
- name: Verify permitted Gitea connectivity
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
curl --fail --silent --show-error \
|
||||
--max-time 15 \
|
||||
https://git.absdev.net/api/v1/version
|
||||
|
||||
echo
|
||||
echo "PASS: Gitea HTTPS connectivity"
|
||||
|
||||
- name: Verify network MTU
|
||||
run: |
|
||||
set -eu
|
||||
test "$(cat /sys/class/net/eth0/mtu)" = "1400"
|
||||
echo "PASS: Network MTU"
|
||||
|
||||
- name: Acceptance result
|
||||
run: |
|
||||
echo "PASS: DEDICATED RUNNER NETWORK ACCEPTANCE"
|
||||
Reference in New Issue
Block a user