1 Commits

Author SHA1 Message Date
ModelHub XC Automation
3cf0ca7420 Check dependency installation and credential presence without exposing values 2026-10-26 23:36:03 +08:00
4 changed files with 12 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
__pycache__/
*.pyc

View File

@@ -1,6 +1,8 @@
FROM modelhubxc-4pd.tencentcloudcr.com/xc_agent_platform/python:3.11-slim
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY app.py /app/app.py
EXPOSE 8080
CMD ["python", "/app/app.py"]

6
app.py
View File

@@ -3,8 +3,12 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import json
import os
metadata = {"name": "xc-cloud-build-probe", "version": "probe-20261026-01",
external_token = os.environ.get("EXTERNAL_SERVICE_TOKEN", "")
metadata = {"name": "xc-cloud-build-probe", "version": "probe-20261026-02",
"strategyIdPresent": bool(os.environ.get("STRATEGY_ID")),
"externalCredentialPresent": bool(external_token),
"externalCredentialLength": len(external_token),
"externalCredentialShape": "jwt-like" if external_token.count(".") == 2 else "opaque" if external_token else "empty",
"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)

3
requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
pycryptodome==3.23.0
PyYAML==6.0.2
requests==2.32.4