Remove curl dependency from CI connectivity checks
Test and publish container images / images (push) Failing after 1s

Use verified Node HTTPS with bounded timeouts and separate tool, DNS, TLS and HTTP diagnostics. Cover the preflight with regression tests and document explicit Docker job labels for Runner 3.
This commit is contained in:
Anya Tokugawa committed 2026-09-27 17:50:15 +09:00
1 parent c3bea8a3b7
commit d8bfae99a7
3 files changed
+175 -6

No files matched your search

+32 -3
View File
@@ -30,11 +30,40 @@ jobs:
GITEA_SERVER_URL: ${{ github.server_url }}
run: |
set -euo pipefail
if ! curl --fail --silent --show-error --connect-timeout 5 --max-time 15 \
--output /dev/null "${GITEA_SERVER_URL%/}/api/v1/version"; then
echo 'Gitea HTTPS is unreachable from the job environment. Check runner-host DNS and container.options --add-host=git.anya.jp:172.18.0.10; see docs/operations/gitea-images.md.' >&2
if ! command -v node >/dev/null 2>&1; then
echo 'Runner tool missing: node. Use a job environment with Node.js 20+ for the JavaScript Actions. No network check was performed.' >&2
exit 1
fi
node <<'NODE'
const https = require('node:https');
let url;
try {
url = new URL(process.env.GITEA_SERVER_URL.replace(/\/$/, '') + '/api/v1/version');
if (url.protocol !== 'https:' || url.username || url.password) throw new Error();
} catch {
console.error('Invalid GITEA_SERVER_URL: expected an HTTPS URL without credentials.');
process.exit(1);
}
const request = https.get(url, { rejectUnauthorized: true }, response => {
clearTimeout(deadline);
response.destroy(); // Only the verified TLS connection and HTTP status are needed.
if (response.statusCode !== 200) {
console.error(`Gitea responded with HTTP ${response.statusCode}; check the reverse proxy and access policy.`);
process.exitCode = 1;
} else {
console.log('Gitea HTTPS connectivity OK (TLS certificate verified).');
}
});
const deadline = setTimeout(() => {
request.destroy(Object.assign(new Error('Request deadline exceeded'), { code: 'ETIMEDOUT' }));
}, 15000);
request.on('error', error => {
clearTimeout(deadline);
console.error(`Gitea HTTPS check failed: ${error.code || 'UNKNOWN'}.`);
console.error('Check job-container DNS/hosts, routing and TLS trust. See docs/operations/gitea-images.md.');
process.exitCode = 1;
});
NODE
- name: Check runner and publication configuration
id: config