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
|
package native
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"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()
|
exec.Command("bash", filepath.Join(DeployTo, "pick-module.sh")).Run()
|
||||||
|
|
||||||
fmt.Printf("[%s] Registering node...\n", node.Name)
|
fmt.Printf("[%s] Registering node...\n", node.Name)
|
||||||
registerCmd := exec.Command(filepath.Join(DeployTo, "register-node"),
|
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||||
"job:register",
|
defer cancel()
|
||||||
"-token", apiToken,
|
registerCmd := exec.CommandContext(ctx, "bash", "-c",
|
||||||
"-host", apiHost,
|
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
|
registerCmd.Dir = DeployTo
|
||||||
|
|
||||||
out, regErr := registerCmd.CombinedOutput()
|
out, regErr := registerCmd.CombinedOutput()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue