Add credential-free cloud build diagnostic
This commit is contained in:
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.git
|
||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
FROM modelhubxc-4pd.tencentcloudcr.com/xc_agent_platform/python:3.11-slim
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
WORKDIR /app
|
||||||
|
COPY app.py /app/app.py
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["python", "/app/app.py"]
|
||||||
6
README.md
Normal file
6
README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# ModelHub cloud build probe
|
||||||
|
|
||||||
|
Minimal standard-library HTTP server to distinguish source retrieval, base-image
|
||||||
|
and dependency-installation failures. Contains no account, password, token or
|
||||||
|
adaptation code. It logs credential-related environment variable names only;
|
||||||
|
values are never read into the log or HTTP response. It does not submit tasks.
|
||||||
24
app.py
Normal file
24
app.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
"""Credential-free probe for the owner's ModelHub cloud deployment."""
|
||||||
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
metadata = {"name": "xc-cloud-build-probe", "version": "probe-20261026-01",
|
||||||
|
"strategyIdPresent": bool(os.environ.get("STRATEGY_ID")),
|
||||||
|
"credentialEnvironmentNames": sorted(name for name in os.environ
|
||||||
|
if any(marker in name for marker in ("TOKEN", "AUTH", "CREDENTIAL", "SECRET", "API_KEY")))}
|
||||||
|
print(json.dumps(metadata), flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
class Handler(BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
data = {"status": "ok"} if self.path.split("?", 1)[0] == "/health" else metadata
|
||||||
|
payload = json.dumps(data).encode()
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header("Content-Type", "application/json")
|
||||||
|
self.send_header("Content-Length", str(len(payload)))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(payload)
|
||||||
|
|
||||||
|
|
||||||
|
ThreadingHTTPServer(("0.0.0.0", 8080), Handler).serve_forever()
|
||||||
Reference in New Issue
Block a user