6 Commits

Author SHA1 Message Date
2e2e127738 add tag to cicd
All checks were successful
Docker Build and Push / docker (push) Successful in 3m23s
2026-05-07 12:29:57 +08:00
aiyueqi
e7ea4960d3 Add token header to image metadata validation
All checks were successful
Docker Build and Push / docker (push) Successful in 1m48s
2026-04-28 14:46:21 +08:00
aiyueqi
239038e87f Validate image metadata before build
Some checks failed
Docker Build and Push / docker (push) Failing after 39s
2026-04-28 14:24:35 +08:00
aiyueqi
654b6be14e Add image verify creator field 2026-04-28 11:30:27 +08:00
012d8f0155 更新 .gitea/workflows/docker-build-push.yml 2026-04-27 18:35:14 +08:00
aiyueqi
5843b25ce3 cicd: post verify api 2026-04-21 18:26:36 +08:00
2 changed files with 77 additions and 0 deletions

View File

@@ -23,6 +23,60 @@ jobs:
echo "IMAGE_NAME=${IMAGE_NAME}" >> "$GITEA_ENV" echo "IMAGE_NAME=${IMAGE_NAME}" >> "$GITEA_ENV"
echo "IMAGE=${IMAGE}" >> "$GITEA_ENV" echo "IMAGE=${IMAGE}" >> "$GITEA_ENV"
- name: Load and Validate Task Info
run: |
set -a
. .gitea/workflows/task_info.env
set +a
for name in FRAMEWORK GPU_TYPE TASK_TYPE; do
eval "value=\${${name}:-}"
if [ "$name" = "FRAMEWORK" ] && [ -z "$value" ]; then
echo "${name} is empty in .gitea/workflows/task_info.env"
exit 1
fi
echo "${name}=${value}" >> "$GITEA_ENV"
done
- name: Validate Image Verify Metadata
run: |
if [ -z "${FIXED_TOKEN:-}" ]; then
echo "FIXED_TOKEN is not configured on runner"
exit 1
fi
if ! response="$(curl --silent --show-error --location --get 'https://modelhub.org.cn/adminApi/image-verify/validate' \
--header "Xc-Token: ${FIXED_TOKEN}" \
--data-urlencode "gpuType=${GPU_TYPE:-}" \
--data-urlencode "taskType=${TASK_TYPE:-}")"; then
echo "failed to call image verify validate API"
exit 1
fi
VALIDATE_RESPONSE="$response" python3 - <<'PY'
import json
import os
import sys
raw = os.environ.get("VALIDATE_RESPONSE", "")
try:
body = json.loads(raw)
except json.JSONDecodeError:
print("image verify validate API returned invalid JSON")
print(raw)
sys.exit(1)
if body.get("code") == 0 and body.get("data") is True:
print("image verify metadata validation passed")
sys.exit(0)
message = body.get("message") or "unknown error"
print(f"image verify metadata validation failed: {message}")
print(raw)
sys.exit(1)
PY
- name: Login to Docker Registry - name: Login to Docker Registry
run: | run: |
echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" \ echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" \
@@ -56,3 +110,23 @@ jobs:
echo "docker push failed after 3 attempts" echo "docker push failed after 3 attempts"
exit 1 exit 1
- name: Notify Image Verify
run: |
if [ -z "${FIXED_TOKEN:-}" ]; then
echo "FIXED_TOKEN is not configured on runner"
exit 1
fi
curl --silent --show-error --fail-with-body --location --request POST 'https://modelhub.org.cn//adminApi/image-verify' \
--header "Xc-Token: ${FIXED_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw "{
\"framework\": \"${FRAMEWORK}\",
\"gpuType\": \"${GPU_TYPE}\",
\"imageUrl\": \"${IMAGE}\",
\"taskType\": \"${TASK_TYPE}\",
\"createBy\": \"${{ gitea.actor }}\",
\"repoUrl\": \"${{ gitea.server_url }}/${{ gitea.repository }}\",
\"tag\": \"${{ github.ref_name }}\"
}"

View File

@@ -0,0 +1,3 @@
FRAMEWORK=transformers
GPU_TYPE=Iluvatar_bi-150
TASK_TYPE=vision_classification