fix: 使用访问域名安装 Agent 并发布下载文件
- 前端提交当前访问 origin,避免反向代理内网地址泄漏 - 校验并安全转义 Agent 服务地址 - 主程序构建时同步生成多平台 Agent 二进制
This commit is contained in:
1 parent
0b785da8ae
commit
7553ef54de
5 files changed
+119
-50
No files matched your search
@@ -572,6 +572,8 @@ kubernetes_update_manifest_image() {
|
||||
build_standalone_binary() {
|
||||
local version_tag="${1:-}"
|
||||
ensure_go_path || return 1
|
||||
# 独立部署依赖 agent/bin 下载资源,主程序构建时一并生成。 // Logan.Li
|
||||
build_agent_binaries || return 1
|
||||
build_frontend_embed
|
||||
ensure_binary_config
|
||||
clean_go_artifacts
|
||||
@@ -853,6 +855,21 @@ cmd_docker() {
|
||||
# ============================================================
|
||||
# 编译独立二进制
|
||||
# ============================================================
|
||||
build_agent_binaries() {
|
||||
cd "$SCRIPT_DIR/agent"
|
||||
mkdir -p bin
|
||||
|
||||
info "编译 Agent Linux AMD64..."
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-linux-amd64 .
|
||||
info "编译 Agent Linux ARM64..."
|
||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-linux-arm64 .
|
||||
info "编译 Agent macOS ARM64..."
|
||||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-darwin-arm64 .
|
||||
info "编译 Agent Windows AMD64..."
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-windows-amd64.exe .
|
||||
success "Agent 多平台二进制编译完成: agent/bin/"
|
||||
}
|
||||
|
||||
cmd_build() {
|
||||
local target=${1:-binary}
|
||||
|
||||
@@ -881,30 +898,7 @@ cmd_build() {
|
||||
;;
|
||||
agent)
|
||||
banner "========== 编译 Agent =========="
|
||||
cd "$SCRIPT_DIR/agent"
|
||||
mkdir -p bin
|
||||
|
||||
info "编译 Linux AMD64..."
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-linux-amd64 .
|
||||
success "bin/aiops-agent-linux-amd64 ($(du -h bin/aiops-agent-linux-amd64 | cut -f1))"
|
||||
|
||||
info "编译 Linux ARM64..."
|
||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-linux-arm64 .
|
||||
success "bin/aiops-agent-linux-arm64 ($(du -h bin/aiops-agent-linux-arm64 | cut -f1))"
|
||||
|
||||
info "编译 macOS ARM64..."
|
||||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-darwin-arm64 .
|
||||
success "bin/aiops-agent-darwin-arm64 ($(du -h bin/aiops-agent-darwin-arm64 | cut -f1))"
|
||||
|
||||
info "编译 Windows AMD64..."
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent-windows-amd64.exe .
|
||||
success "bin/aiops-agent-windows-amd64.exe ($(du -h bin/aiops-agent-windows-amd64.exe | cut -f1))"
|
||||
|
||||
if [ "$OS" = "macos" ]; then
|
||||
info "编译 macOS (当前平台)..."
|
||||
CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/aiops-agent .
|
||||
success "bin/aiops-agent ($(du -h bin/aiops-agent | cut -f1))"
|
||||
fi
|
||||
build_agent_binaries
|
||||
;;
|
||||
frontend)
|
||||
info "构建前端生产包..."
|
||||
|
||||
Reference in new issue
Block a user