Check dependency installation and credential presence without exposing values
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
@@ -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
6
app.py
@@ -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
3
requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
pycryptodome==3.23.0
|
||||
PyYAML==6.0.2
|
||||
requests==2.32.4
|
||||
Reference in New Issue
Block a user