fix: source env.list before register, 60s timeout
This commit is contained in:
parent
452976ab43
commit
842024a6ea
1 changed files with 6 additions and 5 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue