feat: 移除ubuntu镜像中测试相关脚本
This commit is contained in:
+9
-2
@@ -37,7 +37,7 @@ flowchart TD
|
||||
Packages --> S6Install[安装 s6-overlay]
|
||||
S6Install --> XrayInstall[下载并安装 Xray-core]
|
||||
XrayInstall --> User[创建 xray 系统用户]
|
||||
User --> CopyScripts[复制 scripts/]
|
||||
User --> CopyScripts[复制运行时 scripts/]
|
||||
CopyScripts --> CopyRootfs[复制 rootfs/]
|
||||
CopyRootfs --> Entry[ENTRYPOINT /init]
|
||||
```
|
||||
@@ -50,6 +50,7 @@ flowchart TD
|
||||
Ubuntu --> ComposeFile[compose.yml]
|
||||
Ubuntu --> Dockerfile[Dockerfile]
|
||||
Ubuntu --> Test[test.bat]
|
||||
Ubuntu --> Runner[test-runner.sh]
|
||||
Ubuntu --> Scripts[scripts/]
|
||||
Ubuntu --> Rootfs[rootfs/]
|
||||
|
||||
@@ -76,7 +77,7 @@ flowchart TD
|
||||
|
||||
`compose.yml`
|
||||
|
||||
定义 `proxy-on` 和 `proxy-off` 两个测试服务。
|
||||
定义测试服务,并把 `test-runner.sh` 只读挂载到容器内。测试脚本不会进入最终镜像。
|
||||
|
||||
`Dockerfile`
|
||||
|
||||
@@ -86,6 +87,10 @@ flowchart TD
|
||||
|
||||
本地测试脚本。调用 Docker Compose 构建镜像,并依次运行 `proxy-on` 与 `proxy-off`。
|
||||
|
||||
`test-runner.sh`
|
||||
|
||||
容器测试入口。只通过 Docker Compose 临时挂载到 `/tmp/test-runner.sh`,不被 `Dockerfile` 复制进镜像。
|
||||
|
||||
`scripts/xray-url-to-config.sh`
|
||||
|
||||
把受支持的 `vless://...` 转换成 Xray JSON 配置,写到 `/tmp/xray.generated.json`。当前不是通用转换器,只支持下面两类链接:
|
||||
@@ -278,6 +283,8 @@ Ubuntu\test.bat
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Build[docker compose build] --> On[proxy-on]
|
||||
Mount[test-runner.sh 只读挂载] --> On
|
||||
Mount --> Off
|
||||
On --> OnRun[读取 .env 并启用透明代理]
|
||||
OnRun --> OnCurl[curl google.com]
|
||||
OnCurl --> Off[proxy-off]
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ x-test-image: &test-image
|
||||
SOURCE_VERSION: ${SOURCE_VERSION:-local}
|
||||
image: ${IMAGE:-ubuntu-xray-transparent-test}
|
||||
volumes:
|
||||
- ./scripts:/usr/local/bin/scripts:ro
|
||||
- ./test-runner.sh:/tmp/test-runner.sh:ro
|
||||
|
||||
services:
|
||||
ipv6-default-off:
|
||||
@@ -18,7 +18,7 @@ services:
|
||||
S6_LOGGING: "0"
|
||||
command:
|
||||
- bash
|
||||
- /usr/local/bin/scripts/run-test.sh
|
||||
- /tmp/test-runner.sh
|
||||
- ipv6-default-off
|
||||
|
||||
ipv6-enabled:
|
||||
@@ -29,7 +29,7 @@ services:
|
||||
S6_LOGGING: "0"
|
||||
command:
|
||||
- bash
|
||||
- /usr/local/bin/scripts/run-test.sh
|
||||
- /tmp/test-runner.sh
|
||||
- ipv6-enabled
|
||||
|
||||
proxy-on:
|
||||
@@ -42,7 +42,7 @@ services:
|
||||
S6_LOGGING: "0"
|
||||
command:
|
||||
- bash
|
||||
- /usr/local/bin/scripts/run-test.sh
|
||||
- /tmp/test-runner.sh
|
||||
- proxy-on
|
||||
|
||||
proxy-off:
|
||||
@@ -53,5 +53,5 @@ services:
|
||||
S6_LOGGING: "0"
|
||||
command:
|
||||
- bash
|
||||
- /usr/local/bin/scripts/run-test.sh
|
||||
- /tmp/test-runner.sh
|
||||
- proxy-off
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $OutPath,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $ErrPath,
|
||||
|
||||
[string] $VerboseOutput = "0"
|
||||
)
|
||||
|
||||
if ($VerboseOutput -eq "1") {
|
||||
if (Test-Path -LiteralPath $OutPath) {
|
||||
Get-Content -LiteralPath $OutPath
|
||||
}
|
||||
if (Test-Path -LiteralPath $ErrPath) {
|
||||
Get-Content -LiteralPath $ErrPath
|
||||
}
|
||||
exit 0
|
||||
}
|
||||
|
||||
if (Test-Path -LiteralPath $OutPath) {
|
||||
foreach ($line in Get-Content -LiteralPath $OutPath) {
|
||||
if ($line.StartsWith("[PASS]")) {
|
||||
Write-Host $line -ForegroundColor Green
|
||||
} elseif ($line.StartsWith("[NO]")) {
|
||||
Write-Host $line -ForegroundColor Red
|
||||
} elseif ($line.StartsWith("reason:")) {
|
||||
Write-Host $line -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path -LiteralPath $ErrPath) {
|
||||
foreach ($line in Get-Content -LiteralPath $ErrPath) {
|
||||
if ($line.StartsWith("[NO]") -or $line.StartsWith("reason:")) {
|
||||
Write-Host $line -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -48,5 +48,5 @@ if not "%PROXY_ON_CODE%"=="0" exit /b %PROXY_ON_CODE%
|
||||
exit /b %PROXY_OFF_CODE%
|
||||
|
||||
:print_result
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\print-result.ps1 -OutPath "%~1" -ErrPath "%~2" -VerboseOutput "%VERBOSE%"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command "$verbose='%VERBOSE%'; $paths=@('%~1','%~2'); foreach($path in $paths){ if(!(Test-Path -LiteralPath $path)){ continue }; foreach($line in Get-Content -LiteralPath $path){ if($verbose -eq '1'){ Write-Host $line; continue }; if($line.StartsWith('[PASS]')){ Write-Host $line -ForegroundColor Green } elseif($line.StartsWith('[NO]') -or $line.StartsWith('reason:')){ Write-Host $line -ForegroundColor Red } } }"
|
||||
exit /b 0
|
||||
|
||||
Reference in New Issue
Block a user