Tolerate macos nsc ssh handoff exit
This commit is contained in:
parent
ff5736a817
commit
dd369bd0f8
2 changed files with 72 additions and 0 deletions
|
|
@ -363,6 +363,15 @@ func (d *Dispatcher) runMacOSNSCSSHScript(ctx context.Context, runnerName, insta
|
|||
if errors.Is(sshCtx.Err(), context.DeadlineExceeded) {
|
||||
return fmt.Errorf("nsc ssh timed out after %s\n%s", 5*time.Minute, strings.TrimSpace(buf.String()))
|
||||
}
|
||||
if nscSSHBootstrapLikelySucceeded(err, buf.String()) {
|
||||
d.log.Warn("nsc ssh exited after runner handoff; treating bootstrap as successful",
|
||||
"runner", runnerName,
|
||||
"instance", instanceID,
|
||||
"err", err,
|
||||
)
|
||||
d.log.Info("macos runner bootstrap completed via nsc ssh", "runner", runnerName, "instance", instanceID)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("nsc ssh runner bootstrap failed: %w\n%s", err, strings.TrimSpace(buf.String()))
|
||||
}
|
||||
|
||||
|
|
@ -370,6 +379,22 @@ func (d *Dispatcher) runMacOSNSCSSHScript(ctx context.Context, runnerName, insta
|
|||
return nil
|
||||
}
|
||||
|
||||
func nscSSHBootstrapLikelySucceeded(err error, output string) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
errText := strings.ToLower(err.Error())
|
||||
if !strings.Contains(errText, "remote command exited without exit status or exit signal") {
|
||||
return false
|
||||
}
|
||||
|
||||
output = strings.ToLower(output)
|
||||
return strings.Contains(output, "runner registered successfully") &&
|
||||
strings.Contains(output, "starting job") &&
|
||||
strings.Contains(output, "task ")
|
||||
}
|
||||
|
||||
func prependNSCRegionArgs(args []string, computeBaseURL string) []string {
|
||||
region := strings.TrimSpace(os.Getenv("NSC_REGION"))
|
||||
if region == "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue