chore: auto-commit 2026-03-18 14:07

This commit is contained in:
cclohmar 2026-03-18 14:07:13 +00:00
parent 786edd0efd
commit f22d1e5c03

View file

@ -24,12 +24,16 @@ echo -e "${BLUE}====================================================${NC}"
check_connectivity() { check_connectivity() {
echo -e "\n${YELLOW}[1/5] Testing Cloud & Registry Connectivity...${NC}" echo -e "\n${YELLOW}[1/5] Testing Cloud & Registry Connectivity...${NC}"
# 1. Cloud Selection
read -p " Wallarm Cloud (US/EU) [US]: " CLOUD_SEL read -p " Wallarm Cloud (US/EU) [US]: " CLOUD_SEL
CLOUD_SEL=${CLOUD_SEL^^}; CLOUD_SEL=${CLOUD_SEL:-US} CLOUD_SEL=${CLOUD_SEL^^}
CLOUD_SEL=${CLOUD_SEL:-US}
local nodes_to_test=("${US_DATA_NODES[@]}") local nodes_to_test=("${US_DATA_NODES[@]}")
[[ "$CLOUD_SEL" == "EU" ]] && nodes_to_test=("${EU_DATA_NODES[@]}") [[ "$CLOUD_SEL" == "EU" ]] && nodes_to_test=("${EU_DATA_NODES[@]}")
# 2. Test Wallarm API Endpoints
echo " Testing $CLOUD_SEL Cloud Endpoints..."
for node in "${nodes_to_test[@]}"; do for node in "${nodes_to_test[@]}"; do
if curl -skI --connect-timeout 5 "https://$node" > /dev/null 2>&1; then if curl -skI --connect-timeout 5 "https://$node" > /dev/null 2>&1; then
echo -e " ${GREEN}[PASS]${NC} Reached $node" echo -e " ${GREEN}[PASS]${NC} Reached $node"
@ -40,11 +44,25 @@ check_connectivity() {
API_HOST=$([[ "$CLOUD_SEL" == "EU" ]] && echo "api.wallarm.com" || echo "us1.api.wallarm.com") API_HOST=$([[ "$CLOUD_SEL" == "EU" ]] && echo "api.wallarm.com" || echo "us1.api.wallarm.com")
# Check Registry for Pull Capability # 3. Improved Docker Registry Check (Accepting 401 as 'Reachable')
echo -n " Testing Docker Hub Registry Path... "
# Capture the HTTP Status code specifically
REGISTRY_STATUS=$(curl -skI --connect-timeout 5 -o /dev/null -w "%{http_code}" "https://registry-1.docker.io/v2/")
# 401 (Unauthorized) is the expected response from Docker Hub V2 API for unauthenticated probes
if [[ "$REGISTRY_STATUS" == "200" || "$REGISTRY_STATUS" == "401" ]]; then
REGISTRY_REACHABLE=true REGISTRY_REACHABLE=true
if ! curl -skI --connect-timeout 5 "https://registry-1.docker.io/v2/" > /dev/null 2>&1; then echo -e "${GREEN}REACHABLE${NC} (Status: $REGISTRY_STATUS)"
else
REGISTRY_REACHABLE=false REGISTRY_REACHABLE=false
echo -e " ${YELLOW}[WARN]${NC} Docker Hub unreachable. Will look for local .tar image." echo -e "${RED}BLOCKED/OFFLINE${NC} (Status: $REGISTRY_STATUS)"
echo -e " ${YELLOW}i${NC} Falling back to local image check..."
if ! ls *.tar >/dev/null 2>&1; then
echo -e " ${RED}✗ FATAL: Registry unreachable and no local .tar image found.${NC}"
exit 1
fi
fi fi
} }