Test release launcher wiring

This commit is contained in:
2026-11-03 15:45:45 +00:00
parent b94ed6665b
commit 48fd2dc7bc
3 changed files with 168 additions and 870 deletions

View File

@@ -1,506 +1,200 @@
package release_test
import (
"bufio"
"bytes"
"context"
"errors"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"reflect"
"strings"
"testing"
"time"
)
const (
releasePackage = "go.maximumdirect.net/releasekit/cmd/releasekit"
releaseVersion = "v1.2.3-rc.1+local"
)
const tool = "go.maximumdirect.net/releasekit/cmd/releasekit"
func TestReleaseLauncherArgumentHandling(t *testing.T) {
shell := requirePOSIXShell(t)
for _, test := range []struct {
name string
args []string
}{
{name: "no arguments"},
{name: "one argument", args: []string{"core"}},
{name: "multiple arguments", args: []string{"core", "v1.2.3", "extra"}},
{name: "unknown module", args: []string{"unknown", "v1.2.3"}},
} {
t.Run(test.name, func(t *testing.T) {
fixture := newFixture(t)
result := runLauncher(t, shell, fixture, test.args, nil)
var modules = []struct{ selector, dir, profile, product string }{
{"core", ".", "releasekit.json", "CommandKit"},
{"ckconfig", "integrations/ckconfig", "integrations/ckconfig/releasekit.json", "CommandKit ckconfig"},
{"ckprompt", "integrations/ckprompt", "integrations/ckprompt/releasekit.json", "CommandKit ckprompt"},
}
if result.status != 2 {
t.Fatalf("status = %d, want 2; stderr: %q", result.status, result.stderr)
type fixture struct{ root, outside, log string }
func newFixture(t *testing.T) fixture {
t.Helper()
base := t.TempDir()
f := fixture{filepath.Join(base, "repository with spaces"), filepath.Join(base, "outside"), filepath.Join(base, "calls")}
for _, path := range []string{"scripts/release", "scripts/releasekit", "releasekit.json", "integrations/ckconfig/releasekit.json", "integrations/ckprompt/releasekit.json"} {
data, err := os.ReadFile(filepath.Join("..", path))
if err != nil {
t.Fatal(err)
}
dest := filepath.Join(f.root, path)
if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(dest, data, 0755); err != nil {
t.Fatal(err)
}
}
if err := os.MkdirAll(f.outside, 0755); err != nil {
t.Fatal(err)
}
fake := `#!/bin/sh
printf 'called\n' >> "$CALLS"
case "$1 $2" in
'env GOHOSTOS') echo linux ;;
'env GOHOSTARCH') echo amd64 ;;
'env GOFLAGS') echo '-trimpath -mod=mod' ;;
*) printf '%s\n' "$@" > "$CALLS.args"
printf '%s\n' "$PWD" "$GOOS" "$GOARCH" "$GOWORK" "$GOTOOLCHAIN" "$GOFLAGS" > "$CALLS.env"
printf 'tool stdout\n'; printf 'tool stderr\n' >&2; exit "$TOOL_STATUS" ;;
esac
`
if err := os.WriteFile(filepath.Join(base, "go"), []byte(fake), 0755); err != nil {
t.Fatal(err)
}
return f
}
func (f fixture) run(t *testing.T, script string, status int, args ...string) (string, string, int) {
t.Helper()
cmd := exec.Command(filepath.Join(f.root, "scripts", script), args...)
cmd.Dir = f.outside
cmd.Env = append(os.Environ(), "PATH="+filepath.Dir(f.root)+string(os.PathListSeparator)+os.Getenv("PATH"), "CALLS="+f.log, fmt.Sprintf("TOOL_STATUS=%d", status), "CDPATH=/tmp", "GOOS=windows", "GOARCH=arm64", "GOWORK=auto", "GOTOOLCHAIN=auto", "GOFLAGS=-trimpath -mod=mod")
var stdout, stderr strings.Builder
cmd.Stdout, cmd.Stderr = &stdout, &stderr
err := cmd.Run()
if err == nil {
return stdout.String(), stderr.String(), 0
}
if e, ok := err.(*exec.ExitError); ok {
return stdout.String(), stderr.String(), e.ExitCode()
}
t.Fatal(err)
return "", "", -1
}
func lines(t *testing.T, path string) []string {
t.Helper()
b, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
return strings.Split(strings.TrimSuffix(string(b), "\n"), "\n")
}
func TestProfiles(t *testing.T) {
f := newFixture(t)
for _, m := range modules {
t.Run(m.selector, func(t *testing.T) {
var p struct {
Product string `json:"product"`
Module string `json:"module_dir"`
Remote string `json:"remote"`
URL string `json:"expected_push_url"`
Validation struct {
Shared []string `json:"shared_files"`
Format bool `json:"go_format"`
Markdown map[string]any `json:"markdown"`
Distribution map[string]bool `json:"module_distribution"`
Forbidden []string `json:"forbidden_files"`
} `json:"validation"`
Delivery map[string]string `json:"delivery"`
}
if result.stdout != "" {
t.Fatalf("stdout = %q, want empty", result.stdout)
b, err := os.ReadFile(filepath.Join(f.root, m.profile))
if err != nil {
t.Fatal(err)
}
if result.stderr != "usage: ./scripts/release MODULE VERSION\n" {
t.Fatalf("stderr = %q, want usage", result.stderr)
if err := json.Unmarshal(b, &p); err != nil {
t.Fatal(err)
}
if _, err := os.Stat(fixture.goLog); !errors.Is(err, os.ErrNotExist) {
t.Fatalf("Go invocation log exists or could not be checked: %v", err)
if p.Product != m.product || p.Module != m.dir || p.Remote != "origin" || p.URL != "ssh://git@forge.maximumdirect.net:22222/base-layer/commandkit.git" {
t.Fatalf("profile identity: %+v", p)
}
if !reflect.DeepEqual(p.Validation.Shared, []string{"COPYRIGHT", "LICENSE", "docs/oss/attribution.md"}) || !p.Validation.Format || p.Validation.Markdown == nil || len(p.Validation.Markdown) != 0 || !reflect.DeepEqual(p.Validation.Distribution, map[string]bool{"workspace_files": true, "local_replacements": true}) || !reflect.DeepEqual(p.Validation.Forbidden, []string{".releasekit/gitea-token"}) {
t.Fatalf("validation: %+v", p.Validation)
}
if !reflect.DeepEqual(p.Delivery, map[string]string{"forge": "gitea", "base_url": "https://forge.maximumdirect.net", "owner": "base-layer", "repository": "commandkit", "token_file": ".releasekit/gitea-token"}) {
t.Fatalf("delivery: %v", p.Delivery)
}
})
}
}
func TestReleaseLauncherDelegatesPublication(t *testing.T) {
shell := requirePOSIXShell(t)
for _, module := range []string{"core", "ckconfig", "ckprompt"} {
for _, status := range []int{0, 1, 2, 3} {
t.Run(fmt.Sprintf("%s exit status %d", module, status), func(t *testing.T) {
fixture := newFixture(t)
result := runLauncher(t, shell, fixture, []string{module, releaseVersion}, map[string]string{
"CDPATH": "/tmp",
"GOOS": "windows",
"GOARCH": "arm64",
"GOWORK": "auto",
"GOTOOLCHAIN": "auto",
"PUBLISH_EXIT": strconv.Itoa(status),
"PUBLISH_STDOUT": "publisher stdout",
"PUBLISH_STDERR": "publisher stderr",
})
if result.status != status {
t.Fatalf("status = %d, want %d; stderr: %q", result.status, status, result.stderr)
func TestModuleOperations(t *testing.T) {
for _, m := range modules {
for _, op := range []string{"publish", "check", "deliver"} {
t.Run(m.selector+"/"+op, func(t *testing.T) {
f := newFixture(t)
_, _, status := f.run(t, "releasekit", 0, m.selector, op, "v1.2.3", "--option", "value with spaces")
if status != 0 {
t.Fatalf("status %d", status)
}
if result.stdout != "publisher stdout\n" {
t.Fatalf("stdout = %q, want publisher output", result.stdout)
want := []string{"tool", tool, op, "--repo", f.root, "--config", filepath.Join(f.root, m.profile)}
if op == "publish" {
want = append(want, "--expected-module", m.dir)
}
if result.stderr != "publisher stderr\n" {
t.Fatalf("stderr = %q, want publisher error output", result.stderr)
want = append(want, "v1.2.3", "--option", "value with spaces")
if got := lines(t, f.log+".args"); !reflect.DeepEqual(got, want) {
t.Fatalf("args = %#v, want %#v", got, want)
}
if err := checkPublication(readLines(t, fixture.publishLog), fixture.repoRoot, module); err != nil {
t.Fatal(err)
if got := lines(t, f.log+".env"); !reflect.DeepEqual(got, []string{f.root, "linux", "amd64", "off", "local", "-trimpath -mod=mod -mod=readonly"}) {
t.Fatalf("environment: %#v", got)
}
if got := readLines(t, fixture.publishEnvLog); !equalStrings(got, []string{"GOWORK=off", "GOTOOLCHAIN=local"}) {
t.Fatalf("publisher environment = %#v, want workspace disabled and local toolchain", got)
}
assertNativeBootstrap(t, fixture)
})
}
}
}
func TestLauncherChecksRejectContractViolations(t *testing.T) {
root := filepath.Join(t.TempDir(), "repository with spaces")
output := filepath.Join(root, ".releasekit", "bin", "releasekit")
for _, test := range []struct {
name string
change func(*goCall)
}{
{"wrong target", func(c *goCall) { c.goarch = "wrong" }},
{"workspace enabled", func(c *goCall) { c.gowork = "auto" }},
{"toolchain download", func(c *goCall) { c.toolchain = "auto" }},
{"wrong directory", func(c *goCall) { c.cwd = filepath.Dir(root) }},
{"missing readonly", func(c *goCall) { c.args = []string{"build", "-o", output, releasePackage} }},
{"wrong output", func(c *goCall) { c.args[3] = filepath.Join(root, "wrong") }},
{"independent package pin", func(c *goCall) { c.args[4] += "@v0.2.0" }},
} {
t.Run(test.name, func(t *testing.T) {
call := goCall{cwd: root, goos: "linux", goarch: "amd64", gowork: "off", toolchain: "local",
args: []string{"build", "-mod=readonly", "-o", output, releasePackage}}
test.change(&call)
if err := checkNativeBootstrap([]goCall{call}, root, "linux", "amd64"); err == nil {
t.Fatal("invalid bootstrap accepted")
func TestRawAndLegacy(t *testing.T) {
for _, args := range [][]string{{"version", "--help"}, {"publication-attempts", "--json"}, {"reconcile", "--record", "/absolute/path with spaces/attempt.json"}} {
f := newFixture(t)
_, _, status := f.run(t, "releasekit", 0, args...)
if status != 0 {
t.Fatal(status)
}
want := append([]string{"tool", tool}, args...)
if got := lines(t, f.log+".args"); !reflect.DeepEqual(got, want) {
t.Fatalf("args = %#v, want %#v", got, want)
}
}
f := newFixture(t)
_, _, status := f.run(t, "release", 3, "ckprompt", "v1.2.3")
if status != 3 {
t.Fatal(status)
}
want := []string{"tool", tool, "publish", "--repo", f.root, "--config", filepath.Join(f.root, modules[2].profile), "--expected-module", modules[2].dir, "v1.2.3"}
if got := lines(t, f.log+".args"); !reflect.DeepEqual(got, want) {
t.Fatalf("args = %#v, want %#v", got, want)
}
}
func TestStatusAndStreams(t *testing.T) {
for _, status := range []int{0, 1, 2, 3} {
t.Run(fmt.Sprint(status), func(t *testing.T) {
f := newFixture(t)
out, stderr, got := f.run(t, "releasekit", status, "core", "check", "v1.2.3")
if got != status || out != "tool stdout\n" || stderr != "tool stderr\n" {
t.Fatalf("status=%d stdout=%q stderr=%q", got, out, stderr)
}
})
}
for _, args := range [][]string{
{"check", "--repo", root, "--config", filepath.Join(root, "releasekit.json"), "--expected-module", ".", releaseVersion},
{"publish", "--repo", "wrong", "--config", filepath.Join(root, "releasekit.json"), "--expected-module", ".", releaseVersion},
{"publish", "--repo", root, "--config", "wrong", "--expected-module", ".", releaseVersion},
{"publish", "--repo", root, "--config", filepath.Join(root, "releasekit.json"), "--expected-module", ".", "wrong-version"},
{"publish", "--repo", root, "--config", filepath.Join(root, "releasekit.json"), releaseVersion, "--expected-module", "."},
} {
if err := checkPublication(args, root, "core"); err == nil {
t.Errorf("invalid publication accepted: %q", args)
}
func TestInvalidForms(t *testing.T) {
for _, tc := range []struct {
script string
args []string
}{{"releasekit", nil}, {"releasekit", []string{"unknown"}}, {"releasekit", []string{"core"}}, {"releasekit", []string{"core", "version"}}, {"release", nil}, {"release", []string{"core"}}, {"release", []string{"core", "v1", "extra"}}, {"release", []string{"unknown", "v1"}}} {
f := newFixture(t)
_, stderr, status := f.run(t, tc.script, 0, tc.args...)
if status != 2 || !strings.Contains(stderr, "usage:") {
t.Fatalf("%s %v: status=%d stderr=%q", tc.script, tc.args, status, stderr)
}
if _, err := os.Stat(f.log); !os.IsNotExist(err) {
t.Fatalf("Go ran or log inaccessible: %v", err)
}
}
}
func TestReleaseLauncherStopsAfterBootstrapFailure(t *testing.T) {
shell := requirePOSIXShell(t)
fixture := newFixture(t)
result := runLauncher(t, shell, fixture, []string{"core", releaseVersion}, map[string]string{
"FAKE_GO_BUILD_EXIT": "23",
})
if result.status != 23 {
t.Fatalf("status = %d, want build status 23; stderr: %q", result.status, result.stderr)
}
if _, err := os.Stat(fixture.publishLog); !errors.Is(err, os.ErrNotExist) {
t.Fatalf("publisher was invoked or its log could not be checked: %v", err)
}
if !hasGoBuildCall(t, fixture) {
t.Fatal("Go build invocation was not recorded")
}
}
type launcherResult struct {
status int
stdout string
stderr string
}
type fixture struct {
repoRoot string
launcher string
outside string
fakeBin string
goLog string
publishLog string
publishEnvLog string
publisher string
}
func newFixture(t *testing.T) fixture {
t.Helper()
if runtime.GOOS == "windows" {
if _, err := exec.LookPath("sh"); err != nil {
t.Skip("POSIX shell is unavailable")
}
}
_, sourceFile, _, ok := runtime.Caller(0)
if !ok {
t.Fatal("could not locate test source")
}
repo := filepath.Dir(filepath.Dir(sourceFile))
root := t.TempDir()
repoRoot := filepath.Join(root, "CommandKit fixture with spaces")
outside := filepath.Join(root, "outside working directory")
fakeBin := filepath.Join(root, "controlled tools")
for _, dir := range []string{filepath.Join(repoRoot, "scripts"), outside, fakeBin} {
if err := os.MkdirAll(dir, 0o755); err != nil {
t.Fatal(err)
}
}
copyFile(t, filepath.Join(repo, "scripts", "release"), filepath.Join(repoRoot, "scripts", "release"), 0o755)
for _, profile := range []string{
"releasekit.json",
"integrations/ckconfig/releasekit.json",
"integrations/ckprompt/releasekit.json",
} {
target := filepath.Join(repoRoot, profile)
if err := os.MkdirAll(filepath.Dir(target), 0o755); err != nil {
t.Fatal(err)
}
copyFile(t, filepath.Join(repo, profile), target, 0o644)
}
goLog := filepath.Join(root, "go calls.log")
publishLog := filepath.Join(root, "publisher arguments.log")
publishEnvLog := filepath.Join(root, "publisher environment.log")
publisher := filepath.Join(root, "fake publisher")
writeFile(t, publisher, fakePublisher, 0o644)
writeFile(t, filepath.Join(fakeBin, "go"), fakeGo, 0o755)
return fixture{
repoRoot: repoRoot,
launcher: filepath.Join(repoRoot, "scripts", "release"),
outside: outside,
fakeBin: fakeBin,
goLog: goLog,
publishLog: publishLog,
publishEnvLog: publishEnvLog,
publisher: publisher,
}
}
func runLauncher(t *testing.T, shell string, fixture fixture, args []string, overrides map[string]string) launcherResult {
t.Helper()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, shell, append([]string{fixture.launcher}, args...)...)
cmd.Dir = fixture.outside
cmd.Env = fixtureEnvironment(fixture, overrides)
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err := cmd.Run()
result := launcherResult{stdout: stdout.String(), stderr: stderr.String()}
if err == nil {
return result
}
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
result.status = exitErr.ExitCode()
return result
}
t.Fatalf("run launcher: %v", err)
return launcherResult{}
}
func fixtureEnvironment(fixture fixture, overrides map[string]string) []string {
values := map[string]string{
"PATH": fixture.fakeBin + string(os.PathListSeparator) + os.Getenv("PATH"),
"GO_LOG": fixture.goLog,
"PUBLISH_ARGS_LOG": fixture.publishLog,
"PUBLISH_ENV_LOG": fixture.publishEnvLog,
"FAKE_GOHOSTOS": "linux",
"FAKE_GOHOSTARCH": "amd64",
"FAKE_PUBLISHER_SOURCE": fixture.publisher,
"FAKE_GO_BUILD_EXIT": "0",
"PUBLISH_EXIT": "0",
"PUBLISH_STDOUT": "publisher stdout",
"PUBLISH_STDERR": "publisher stderr",
}
for key, value := range overrides {
values[key] = value
}
var env []string
for _, entry := range os.Environ() {
key, _, _ := strings.Cut(entry, "=")
if _, overridden := values[key]; !overridden {
env = append(env, entry)
}
}
for key, value := range values {
env = append(env, key+"="+value)
}
return env
}
func assertNativeBootstrap(t *testing.T, fixture fixture) {
t.Helper()
if err := checkNativeBootstrap(readGoCalls(t, fixture.goLog), fixture.repoRoot, "linux", "amd64"); err != nil {
t.Fatal(err)
}
}
func checkNativeBootstrap(calls []goCall, root, hostOS, hostArch string) error {
foundBuild := false
for _, call := range calls {
if call.cwd != root {
return fmt.Errorf("Go ran in %q, want repository root %q", call.cwd, root)
}
if call.gowork != "off" || call.toolchain != "local" {
return fmt.Errorf("Go settings = GOWORK=%q GOTOOLCHAIN=%q", call.gowork, call.toolchain)
}
if len(call.args) > 0 && call.args[0] == "build" {
foundBuild = true
if call.args[len(call.args)-1] != releasePackage {
return fmt.Errorf("build does not select module-owned package %q: %q", releasePackage, call.args)
}
if argumentValue(call.args[1:], "-mod") != "readonly" {
return fmt.Errorf("build does not use readonly module metadata: %q", call.args)
}
output := argumentValue(call.args[1:], "-o")
if !filepath.IsAbs(output) {
output = filepath.Join(call.cwd, output)
}
if filepath.Clean(output) != filepath.Join(root, ".releasekit", "bin", "releasekit") {
return fmt.Errorf("incorrect build output %q", output)
}
if call.goos != hostOS || call.goarch != hostArch {
return fmt.Errorf("build target = %s/%s, want %s/%s", call.goos, call.goarch, hostOS, hostArch)
}
}
}
if !foundBuild {
return errors.New("no native build observed")
}
return nil
}
// Inspect only the selected build options, leaving other Go flags to Go itself.
func argumentValue(args []string, name string) string {
value := ""
for i := 0; i < len(args); i++ {
if args[i] == name && i+1 < len(args) {
i++
value = args[i]
} else if supplied, ok := strings.CutPrefix(args[i], name+"="); ok {
value = supplied
}
}
return value
}
func checkPublication(args []string, root, selector string) error {
modules := map[string]string{
"core": ".",
"ckconfig": "integrations/ckconfig",
"ckprompt": "integrations/ckprompt",
}
module, ok := modules[selector]
if !ok {
return fmt.Errorf("unknown module selector %q", selector)
}
profile := map[string]string{
"core": "releasekit.json",
"ckconfig": "integrations/ckconfig/releasekit.json",
"ckprompt": "integrations/ckprompt/releasekit.json",
}[selector]
want := []string{
"publish",
"--repo", root,
"--config", filepath.Join(root, profile),
"--expected-module", module,
releaseVersion,
}
if !equalStrings(args, want) {
return fmt.Errorf("publication arguments = %q, want %q", args, want)
}
return nil
}
type goCall struct {
cwd string
goos string
goarch string
gowork string
toolchain string
args []string
}
func readGoCalls(t *testing.T, path string) []goCall {
t.Helper()
file, err := os.Open(path)
if err != nil {
t.Fatal(err)
}
defer file.Close()
var calls []goCall
scanner := bufio.NewScanner(file)
for scanner.Scan() {
fields := strings.Split(scanner.Text(), "\t")
if len(fields) < 6 {
t.Fatalf("malformed Go call record: %q", scanner.Text())
}
argc, err := strconv.Atoi(fields[5])
if err != nil || len(fields) != 6+argc {
t.Fatalf("malformed Go arguments in record: %q", scanner.Text())
}
calls = append(calls, goCall{
cwd: fields[0],
goos: fields[1],
goarch: fields[2],
gowork: fields[3],
toolchain: fields[4],
args: fields[6:],
})
}
if err := scanner.Err(); err != nil {
t.Fatal(err)
}
return calls
}
func hasGoBuildCall(t *testing.T, fixture fixture) bool {
t.Helper()
for _, call := range readGoCalls(t, fixture.goLog) {
if len(call.args) > 0 && call.args[0] == "build" {
return true
}
}
return false
}
func readLines(t *testing.T, path string) []string {
t.Helper()
data, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
return strings.Split(strings.TrimSuffix(string(data), "\n"), "\n")
}
func copyFile(t *testing.T, source, destination string, mode os.FileMode) {
t.Helper()
data, err := os.ReadFile(source)
if err != nil {
t.Fatal(err)
}
writeFile(t, destination, string(data), mode)
}
func writeFile(t *testing.T, path, data string, mode os.FileMode) {
t.Helper()
if err := os.WriteFile(path, []byte(data), mode); err != nil {
t.Fatal(err)
}
}
func requirePOSIXShell(t *testing.T) string {
t.Helper()
shell, err := exec.LookPath("sh")
if err != nil {
t.Skip("POSIX shell is unavailable")
}
return shell
}
func equalStrings(got, want []string) bool {
if len(got) != len(want) {
return false
}
for i := range got {
if got[i] != want[i] {
return false
}
}
return true
}
const fakeGo = `#!/bin/sh
set -eu
printf '%s\t%s\t%s\t%s\t%s\t%s' "$PWD" "${GOOS-}" "${GOARCH-}" "${GOWORK-}" "${GOTOOLCHAIN-}" "$#" >> "$GO_LOG"
for arg do printf '\t%s' "$arg" >> "$GO_LOG"; done
printf '\n' >> "$GO_LOG"
if [ "$1" = env ]; then
shift
for name do
case "$name" in
GOHOSTOS) printf '%s\n' "$FAKE_GOHOSTOS" ;;
GOHOSTARCH) printf '%s\n' "$FAKE_GOHOSTARCH" ;;
*) exit 90 ;;
esac
done
exit 0
fi
if [ "$1" = build ]; then
if [ "$FAKE_GO_BUILD_EXIT" -ne 0 ]; then exit "$FAKE_GO_BUILD_EXIT"; fi
output=
expect_output=0
for arg do
if [ "$expect_output" -eq 1 ]; then
output=$arg
expect_output=0
continue
fi
if [ "$arg" = -o ]; then expect_output=1; fi
case "$arg" in -o=*) output=${arg#-o=} ;; esac
done
[ -n "$output" ] || exit 91
cat "$FAKE_PUBLISHER_SOURCE" > "$output"
chmod +x "$output"
exit 0
fi
exit 92
`
const fakePublisher = `#!/bin/sh
set -eu
printf '%s\n' "$@" > "$PUBLISH_ARGS_LOG"
printf 'GOWORK=%s\nGOTOOLCHAIN=%s\n' "${GOWORK-}" "${GOTOOLCHAIN-}" > "$PUBLISH_ENV_LOG"
printf '%s\n' "$PUBLISH_STDOUT"
printf '%s\n' "$PUBLISH_STDERR" >&2
exit "$PUBLISH_EXIT"
`