From 2c2bc471030294f76f1eef8a8520f6cb7ebd08d9 Mon Sep 17 00:00:00 2001 From: zoedong Date: Fri, 17 Apr 2026 14:20:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20add=20test-hello=20v2.0=20=E2=80=94?= =?UTF-8?q?=20=E4=B8=89=E7=BA=A7=E7=9B=AE=E5=BD=95=20+=20build.conf=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 验证多版本目录结构 frameworks/test-hello/2.0/ 的 CI 流程: - detect_changes.sh 回溯查找 Dockerfile - validate.sh 三级目录强制 build.conf 校验 - build_and_test.sh 从 build.conf 读取 IMAGE_NAME/IMAGE_TAG Co-Authored-By: Claude Opus 4.6 (1M context) --- frameworks/test-hello/2.0/Dockerfile | 8 ++++++++ frameworks/test-hello/2.0/README.md | 21 +++++++++++++++++++++ frameworks/test-hello/2.0/build.conf | 3 +++ frameworks/test-hello/2.0/test.sh | 20 ++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 frameworks/test-hello/2.0/Dockerfile create mode 100644 frameworks/test-hello/2.0/README.md create mode 100644 frameworks/test-hello/2.0/build.conf create mode 100644 frameworks/test-hello/2.0/test.sh diff --git a/frameworks/test-hello/2.0/Dockerfile b/frameworks/test-hello/2.0/Dockerfile new file mode 100644 index 0000000..5991219 --- /dev/null +++ b/frameworks/test-hello/2.0/Dockerfile @@ -0,0 +1,8 @@ +FROM opencloudos/opencloudos9-minimal:latest + +LABEL maintainer="ZoeDong " +LABEL org.opencontainers.image.description="CI pipeline test image (versioned dir)" + +RUN dnf install -y python3 && dnf clean all + +CMD ["python3", "-c", "print('Hello from OpenCloudOS 9 v2.0!')"] diff --git a/frameworks/test-hello/2.0/README.md b/frameworks/test-hello/2.0/README.md new file mode 100644 index 0000000..31d11f2 --- /dev/null +++ b/frameworks/test-hello/2.0/README.md @@ -0,0 +1,21 @@ +# test-hello v2.0 on OpenCloudOS 9 + +> 三级目录结构测试用例(frameworks/test-hello/2.0/) + +## 基本信息 +- **镜像名**: test-hello +- **版本**: 2.0 +- **基础镜像**: opencloudos/opencloudos9-minimal:latest +- **用途**: 验证多版本目录 + build.conf 的 CI 流程 + +## 构建 + +```bash +docker build -t test-hello:2.0 frameworks/test-hello/2.0/ +``` + +## 使用 + +```bash +docker run --rm test-hello:2.0 +``` diff --git a/frameworks/test-hello/2.0/build.conf b/frameworks/test-hello/2.0/build.conf new file mode 100644 index 0000000..c613be6 --- /dev/null +++ b/frameworks/test-hello/2.0/build.conf @@ -0,0 +1,3 @@ +IMAGE_NAME=test-hello +IMAGE_TAG=2.0 +GPU_TEST=false diff --git a/frameworks/test-hello/2.0/test.sh b/frameworks/test-hello/2.0/test.sh new file mode 100644 index 0000000..dc7e481 --- /dev/null +++ b/frameworks/test-hello/2.0/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +IMAGE="${1:?ERROR: Missing image parameter. Usage: bash test.sh }" + +echo "=== test-hello v2.0 CI test ===" + +echo -n "Check python3 available... " +sudo docker run --rm "$IMAGE" python3 --version && echo "✓ passed" || { echo "✗ failed"; exit 1; } + +echo -n "Check hello output... " +OUTPUT=$(sudo docker run --rm "$IMAGE") +if echo "$OUTPUT" | grep -q "Hello from OpenCloudOS 9 v2.0"; then + echo "✓ passed" +else + echo "✗ failed: unexpected output: $OUTPUT" + exit 1 +fi + +echo "=== All tests passed ===" -- Gitee From ef671076a2e6e7d5638776b740d5f5606dffc921 Mon Sep 17 00:00:00 2001 From: samblade <812101+samblade@user.noreply.gitee.com> Date: Thu, 30 Apr 2026 09:47:50 +0000 Subject: [PATCH 2/2] update frameworks/test-hello/2.0/test.sh. Signed-off-by: samblade <812101+samblade@user.noreply.gitee.com> --- frameworks/test-hello/2.0/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/test-hello/2.0/test.sh b/frameworks/test-hello/2.0/test.sh index dc7e481..bd0b5cd 100644 --- a/frameworks/test-hello/2.0/test.sh +++ b/frameworks/test-hello/2.0/test.sh @@ -4,7 +4,7 @@ set -e IMAGE="${1:?ERROR: Missing image parameter. Usage: bash test.sh }" echo "=== test-hello v2.0 CI test ===" - +docker system prune -f echo -n "Check python3 available... " sudo docker run --rm "$IMAGE" python3 --version && echo "✓ passed" || { echo "✗ failed"; exit 1; } -- Gitee