Run recovery handoffs for the host target

This commit is contained in:
2026-11-04 00:52:04 +00:00
parent d8ec9389e0
commit bd693ca31b
3 changed files with 12 additions and 6 deletions

View File

@@ -142,16 +142,17 @@ func selectedPublicationRecoveryCommand(ctx context.Context, result releasekit.P
if err != nil {
return "", err
}
if len(args) > 0 {
command := "env GOWORK=off GOTOOLCHAIN=local go"
for _, arg := range args {
if args != nil {
prefix := "go -C " + shellQuote(git.DisplayDiagnostic(args.Directory))
command := "(export GOWORK=off GOTOOLCHAIN=local && releasekit_host_os=$(" + prefix + " env GOHOSTOS) && releasekit_host_arch=$(" + prefix + " env GOHOSTARCH) && GOOS=\"$releasekit_host_os\" GOARCH=\"$releasekit_host_arch\" " + prefix
for _, arg := range args.Args {
command += " " + shellQuote(git.DisplayDiagnostic(arg))
}
path, err := filepath.Abs(git.DisplayDiagnostic(result.RecordPath))
if err != nil {
return "", err
}
return command + " reconcile --record " + shellQuote(path), nil
return command + " reconcile --record " + shellQuote(path) + ")", nil
}
}
return publicationRecoveryCommand(result.RecordPath)

View File

@@ -256,7 +256,8 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) {
}
// Execute from another directory after the original driver and the
// API-only launcher's temporary files are gone.
evidence, err := publish.LoadEvidence(outputLineValue(text, "publication record saved: "))
originalRecord := outputLineValue(text, "publication record saved: ")
evidence, err := publish.LoadEvidence(originalRecord)
if err != nil {
t.Fatal(err)
}
@@ -277,10 +278,12 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) {
}
selected := command
if scenario.record != "" {
selected += " --record " + shellQuote(scenario.record)
selected = strings.Replace(selected, shellQuote(originalRecord), shellQuote(scenario.record), 1)
}
recovery := exec.Command("sh", "-c", selected)
recovery.Dir = t.TempDir()
foreignOS, foreignArch := foreignTarget()
recovery.Env = setEnvironment(setEnvironment(os.Environ(), "GOOS", foreignOS), "GOARCH", foreignArch)
recovered, err := recovery.CombinedOutput()
if scenario.status == 0 && err != nil || scenario.status != 0 && (!errors.As(err, &exitError) || exitError.ExitCode() != scenario.status) {
t.Fatalf("recovery status want %d: %v: %s", scenario.status, err, recovered)

View File

@@ -129,6 +129,8 @@ checks in Stage 6.
## Stage 5: Normalize the printed recovery command when it runs
**Completed.**
1. In `selectedPublicationRecoveryCommand` in
[the CLI](../../cmd/releasekit/main.go), render the descriptor as one
copyable POSIX shell command. Use this structure, with `<dir>`,