From 842024a6ea22156ed6bd6757196db1b31ac345b7 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 1 Aug 2026 19:52:29 +0000 Subject: [PATCH] fix: source env.list before register, 60s timeout --- internal/native/native.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/native/native.go b/internal/native/native.go index 61fbe8c..0a1c75c 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -1,6 +1,7 @@ package native import ( + "context" "fmt" "os" "os/exec" @@ -83,11 +84,11 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error { exec.Command("bash", filepath.Join(DeployTo, "pick-module.sh")).Run() fmt.Printf("[%s] Registering node...\n", node.Name) - registerCmd := exec.Command(filepath.Join(DeployTo, "register-node"), - "job:register", - "-token", apiToken, - "-host", apiHost, - ) + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + registerCmd := exec.CommandContext(ctx, "bash", "-c", + fmt.Sprintf("source %s/env.list 2>/dev/null; %s/register-node job:register -token '%s' -host '%s'", + DeployTo, DeployTo, apiToken, apiHost)) registerCmd.Dir = DeployTo out, regErr := registerCmd.CombinedOutput()