From 96bebdcd4a38d4b180b71f22893b8d86727cdb37 Mon Sep 17 00:00:00 2001 From: Zachary Schneider Date: Fri, 4 Dec 2026 12:44:26 -0500 Subject: [PATCH 1/2] chore: bump orbital to v0.2.8 v0.2.6 onwards re-invokes the CLI with sudo -E, so the environment reaches the privileged run. v0.2.5 dropped it under sudo's default env_reset. --- go.mod | 11 ++++++----- go.sum | 22 ++++++++++++---------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index c875c14cd..110030ed3 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( github.com/platform-engineering-labs/formae/tests/testcontrol v0.0.0-00010101000000-000000000000 github.com/platform-engineering-labs/jsonpatch v0.0.0-20260921135532-7c58038cb9c7 github.com/platform-engineering-labs/oox/provx v0.0.0-20260905021850-40f9d81e8f38 // re-pin to a real tag at release time - github.com/platform-engineering-labs/orbital v0.2.5 + github.com/platform-engineering-labs/orbital v0.2.8 github.com/posthog/posthog-go v1.6.3 github.com/pressly/goose/v3 v3.26.0 github.com/prometheus/client_golang v1.23.2 @@ -140,18 +140,19 @@ require ( github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/asdine/storm v2.1.2+incompatible // indirect github.com/atotto/clipboard v0.1.4 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.17 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.38 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.42 // indirect github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.10 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.1 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.1 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.39 // indirect github.com/aws/aws-sdk-go-v2/service/iam v1.59.2 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.17 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.29 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.38 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.97.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.37 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.107.1 // indirect github.com/aws/aws-sdk-go-v2/service/signin v1.5.7 // indirect github.com/aws/aws-sdk-go-v2/service/ssm v1.44.7 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.33.7 // indirect diff --git a/go.sum b/go.sum index 2d490c61f..b6ee85d19 100644 --- a/go.sum +++ b/go.sum @@ -94,14 +94,16 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= github.com/aws/aws-sdk-go-v2 v1.45.1 h1:iIoG3NaLhV6UZpPXyPXlDj2I9oS8tV/nMcMnITCC6Ks= github.com/aws/aws-sdk-go-v2 v1.45.1/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7 h1:3kGOqnh1pPeddVa/E37XNTaWJ8W6vrbYV9lJEkCnhuY= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.17 h1:mn+Vxb9zgz/FE/yDTcFim3DZ1qpcrxR+qBQkBrl6bzA= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.17/go.mod h1:eDfmEFxu+BSVsUGLbzJhWjpOurv1mqczClS97yI8wdk= github.com/aws/aws-sdk-go-v2/config v1.32.38 h1:n4yPHBjtQ3BrIIUyk0/LAqf/BL2iv0Tw6XZcMRzM0ps= github.com/aws/aws-sdk-go-v2/config v1.32.38/go.mod h1:dencYsOS1R7rBy8zehCvwBYzdxxL4Q/nRK7In03wjN8= github.com/aws/aws-sdk-go-v2/credentials v1.19.37 h1:FJ8Iz4/xISMB/rwLlgfWujfGDFWr0oneQgtA6KPcYLY= github.com/aws/aws-sdk-go-v2/credentials v1.19.37/go.mod h1:Q6pWOgVUp49x4g5QVi29wHofUoICnZ+Zq4jHbRN/7ec= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.38 h1:Nqo2jU1wz5rnBM9XQyXfVD1RP8txkbP3EDx8hR/hbCE= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.38/go.mod h1:PzJFHhjR2vWFKHe8HmY5Lxhvwyxnr5MERtk0nDxWNbk= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.42 h1:UuK6LmQ5GD5JL7x5OY1L9xo93xAQb1wjYOlngNxa9YA= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.42/go.mod h1:BEYAPq1qDt9iBiEwZr0zJCJIHgGVDz67iV9Hw9D6z58= github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.10 h1:2KCL4TmeiNvpPedtC4Bey5jvjRLD74WUYqGeHJ//aco= github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.10/go.mod h1:KwaiUFVO7pG8Z9F5bMGvvrRibdSDaAu8HtlKGKkjZSA= github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.1 h1:pc138gM1CW+XPc60rEwUlwwuwWFQK16CI1T7v1F9Oec= @@ -114,16 +116,16 @@ github.com/aws/aws-sdk-go-v2/service/iam v1.59.2 h1:An/8OH+HhHxKar6bDa8v1ITiG7V3 github.com/aws/aws-sdk-go-v2/service/iam v1.59.2/go.mod h1:gQRbwtyMFDBnV/58n5bVWmZi50c7H2HN/+ikrW876So= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.17 h1:OvYZOB3qA6zvfdRFiRFRzVSiElMYrz3GdntkXZxlp1o= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.17/go.mod h1:JgR/2Ew50ACfIWau1oeMRX59tMtC0kM+PYQGEaT04cY= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12 h1:qtJZ70afD3ISKWnoX3xB0J2otEqu3LqicRcDBqsj0hQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12/go.mod h1:v2pNpJbRNl4vEUWEh5ytQok0zACAKfdmKS51Hotc3pQ= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.29 h1:E65Hj648dOV6FuUfI0mYXXhQRHbsi7n+B9h6fZPJO/E= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.29/go.mod h1:xLrF9yNTCs92VZSpdEd68EJbgcdw3SMR74RO6QDzWHE= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.38 h1:H/5TI1jqaHsNoDQ60UwvPvJBg4GURkinXI3Qga29t2w= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.38/go.mod h1:PTVFf+XH++7NJOky+RLBYQx0QA5NcaeEYFQ2fsi0nwo= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20 h1:siU1A6xjUZ2N8zjTHSXFhB9L/2OY8Dqs0xXiLjF30jA= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20/go.mod h1:4TLZCmVJDM3FOu5P5TJP0zOlu9zWgDWU7aUxWbr+rcw= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.37 h1:KGHa9iZCrgtkOsFfXb0S4ywsjostA/hau7WE9aSb43E= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.37/go.mod h1:FV79f0DSnZIEGsQjWenENGtUycrasyAaJZO+zRanLHA= github.com/aws/aws-sdk-go-v2/service/rdsdata v1.32.17 h1:poHYttXFhpCUps5xl5e1GBclCEt4B5dH7RwAjAgp/Yo= github.com/aws/aws-sdk-go-v2/service/rdsdata v1.32.17/go.mod h1:u5Kzt/39CDtazPRSl5xfkIp/YsLpxJtbxb0AioIUFsw= -github.com/aws/aws-sdk-go-v2/service/s3 v1.97.1 h1:csi9NLpFZXb9fxY7rS1xVzgPRGMt7MSNWeQ6eo247kE= -github.com/aws/aws-sdk-go-v2/service/s3 v1.97.1/go.mod h1:qXVal5H0ChqXP63t6jze5LmFalc7+ZE7wOdLtZ0LCP0= +github.com/aws/aws-sdk-go-v2/service/s3 v1.107.1 h1:VUTtUJMuRNMkb/7NIKmd8NQaeQLPGCMoTJxkYKre4qM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.107.1/go.mod h1:WvUaO0lP5GNMs1R6cs6qvB3mqo16GLta8yfOuf55Rpc= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.47.0 h1:LjEecQF5MLvqi1H/fMlU4JL6aQZyN/7BYMynz6PVnxQ= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.47.0/go.mod h1:2rdJeO95tT+EGmjF4jWmIzNKRwIMpr7Dnf7W6mIB9EQ= github.com/aws/aws-sdk-go-v2/service/signin v1.5.7 h1:YcczQ6zNH/ojIzD/ikDrO+RfW06wmdMp18d4NH5hXY4= @@ -483,8 +485,8 @@ github.com/platform-engineering-labs/oox/gcpname v0.0.0-20260825170105-3bd97cb18 github.com/platform-engineering-labs/oox/gcpname v0.0.0-20260825170105-3bd97cb18d15/go.mod h1:wytVDQEOgo/0PLmMj0nOnisBzzqwemanNy9gpueH9Ik= github.com/platform-engineering-labs/oox/provx v0.0.0-20260905021850-40f9d81e8f38 h1:mXV1j81cMGKoEKal3trLT617utgH8l04I1xzHoUHACA= github.com/platform-engineering-labs/oox/provx v0.0.0-20260905021850-40f9d81e8f38/go.mod h1:ySd/XvwrvHJv9Qqb4JM5SOrvmMf3BdQMGo2Ae77U+UM= -github.com/platform-engineering-labs/orbital v0.2.5 h1:7rihasWnR68ORytqLubR5WMJchv/mxoWSCB7MqaB9tU= -github.com/platform-engineering-labs/orbital v0.2.5/go.mod h1:wwVPqOmW5RO78dDzL/G5CN1Ioao0P/aUsOZVrPVx64s= +github.com/platform-engineering-labs/orbital v0.2.8 h1:mKwEb6qmIbjHgH7MYSq1O4+DOIw46by8nioowWuQBDQ= +github.com/platform-engineering-labs/orbital v0.2.8/go.mod h1:Tls4Quxi5znwWIZvrutnMAiI+GyCOE+UGhSQd++CYcY= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= From eefdea36585f727439c81ce27b5b3b2cee1d4c58 Mon Sep 17 00:00:00 2001 From: Zachary Schneider Date: Fri, 4 Dec 2026 12:44:26 -0500 Subject: [PATCH 2/2] fix(cli): do not print the banner again on the sudo re-invoke Commands that build a package manager against a root-owned install tree are re-invoked under sudo, and the second run printed the banner a second time. They now set PEL_NO_BANNER once their own banner is out, so the re-invoked process stays quiet. --- internal/cli/banner/banner.go | 8 ++++++++ internal/cli/banner/banner_test.go | 23 +++++++++++++++++++++++ internal/cli/clean/clean.go | 2 ++ internal/cli/plugin/manager.go | 4 ++++ internal/cli/refresh/refresh.go | 2 ++ internal/cli/update/update.go | 3 +++ 6 files changed, 42 insertions(+) diff --git a/internal/cli/banner/banner.go b/internal/cli/banner/banner.go index e51475e26..0b6d6e1eb 100644 --- a/internal/cli/banner/banner.go +++ b/internal/cli/banner/banner.go @@ -60,6 +60,14 @@ var isTerminal = func(w io.Writer) bool { return tui.IsTerminal(w) } +// Suppress sets PEL_NO_BANNER for the rest of this process and anything it +// execs. Commands that build a package manager call it once their own banner +// is out: when the install tree is root-owned the manager re-execs the CLI +// under sudo, and the second run would otherwise print the banner again. +func Suppress() { + _ = os.Setenv(NoBannerEnv, "true") +} + // ClearScreen clears the terminal screen. func ClearScreen() { _, _ = fmt.Print("\033[2J") // Clear screen diff --git a/internal/cli/banner/banner_test.go b/internal/cli/banner/banner_test.go index d77add672..e9244a170 100644 --- a/internal/cli/banner/banner_test.go +++ b/internal/cli/banner/banner_test.go @@ -165,3 +165,26 @@ func TestPrintTextBanner_NeverDrawsGraphics(t *testing.T) { assert.Contains(t, text, "v"+formae.Version, "PrintTextBanner must still show the version") assert.True(t, strings.ContainsRune(text, '⣿') || strings.ContainsAny(text, "⠀⠁⠂⠃⠄⡀⢀⣀"), "PrintTextBanner must draw the braille logo") } + +// TestSuppress verifies that Suppress sets PEL_NO_BANNER so that this process +// and anything it execs stop printing the banner. +func TestSuppress(t *testing.T) { + origIsTerminal := isTerminal + origDetect := detect + t.Cleanup(func() { + isTerminal = origIsTerminal + detect = origDetect + }) + + isTerminal = func(_ io.Writer) bool { return true } + detect = func() logo.Capability { return logo.CapText } + + // Registers the restore of the variable Suppress is about to set. + t.Setenv(NoBannerEnv, "") + require.NotEmpty(t, captureStdout(func() { PrintBanner() })) + + Suppress() + + assert.Equal(t, "true", os.Getenv(NoBannerEnv)) + assert.Empty(t, captureStdout(func() { PrintBanner() })) +} diff --git a/internal/cli/clean/clean.go b/internal/cli/clean/clean.go index 31a57b720..8ebbb752e 100644 --- a/internal/cli/clean/clean.go +++ b/internal/cli/clean/clean.go @@ -11,6 +11,7 @@ import ( "os" "github.com/platform-engineering-labs/formae/internal/cli/app" + "github.com/platform-engineering-labs/formae/internal/cli/banner" clicmd "github.com/platform-engineering-labs/formae/internal/cli/cmd" "github.com/platform-engineering-labs/formae/internal/cli/tui/components" "github.com/platform-engineering-labs/formae/internal/cli/tui/theme" @@ -46,6 +47,7 @@ func CleanCmd() *cobra.Command { return err } a.PrintBanner() + banner.Suppress() orb, err := opsmgr.New(slog.Default(), a.Config.Artifacts.URL, "", true, true) if err != nil { diff --git a/internal/cli/plugin/manager.go b/internal/cli/plugin/manager.go index bf106a93f..966e4171a 100644 --- a/internal/cli/plugin/manager.go +++ b/internal/cli/plugin/manager.go @@ -10,6 +10,7 @@ import ( "sort" "strings" + "github.com/platform-engineering-labs/formae/internal/cli/banner" "github.com/platform-engineering-labs/formae/internal/opsmgr" apimodel "github.com/platform-engineering-labs/formae/pkg/api/model" pkgmodel "github.com/platform-engineering-labs/formae/pkg/model" @@ -45,6 +46,9 @@ func NewCLIPluginManager(logger *slog.Logger, repos []pkgmodel.Repository, chann if len(repos) == 0 { return nil, nil } + // Every plugin command prints its banner before it gets here, so the sudo + // re-exec below must not print a second one. + banner.Suppress() orb, err := opsmgr.NewFromRepositories(logger, repos, channel, sudo, writable) if err != nil { return nil, err diff --git a/internal/cli/refresh/refresh.go b/internal/cli/refresh/refresh.go index 5422f8ea2..da41e29bf 100644 --- a/internal/cli/refresh/refresh.go +++ b/internal/cli/refresh/refresh.go @@ -13,6 +13,7 @@ import ( "sync/atomic" "github.com/platform-engineering-labs/formae/internal/cli/app" + "github.com/platform-engineering-labs/formae/internal/cli/banner" clicmd "github.com/platform-engineering-labs/formae/internal/cli/cmd" "github.com/platform-engineering-labs/formae/internal/cli/config" "github.com/platform-engineering-labs/formae/internal/cli/tui" @@ -94,6 +95,7 @@ sudo.`, return err } a.PrintBanner() + banner.Suppress() // orbital's Refresh() always returns nil, logging per-repository // fetch failures at ERROR level instead. Count those so we don't diff --git a/internal/cli/update/update.go b/internal/cli/update/update.go index 85ee9ef0f..19505797f 100644 --- a/internal/cli/update/update.go +++ b/internal/cli/update/update.go @@ -13,6 +13,7 @@ import ( "github.com/platform-engineering-labs/formae/internal/agent" "github.com/platform-engineering-labs/formae/internal/cli/app" + "github.com/platform-engineering-labs/formae/internal/cli/banner" clicmd "github.com/platform-engineering-labs/formae/internal/cli/cmd" "github.com/platform-engineering-labs/formae/internal/cli/config" "github.com/platform-engineering-labs/formae/internal/cli/tui" @@ -170,6 +171,7 @@ func UpdateCmd() *cobra.Command { return err } a.PrintBanner() + banner.Suppress() var orb *mgr.Manager if len(a.Config.Artifacts.Repositories) > 0 { @@ -301,6 +303,7 @@ func UpdateListCmd() *cobra.Command { return err } a.PrintBanner() + banner.Suppress() var orb *mgr.Manager if len(a.Config.Artifacts.Repositories) > 0 {