avoid failing compose config on failure to load stack#1878
avoid failing compose config on failure to load stack#1878jordanstephens merged 2 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughmakeComposeConfigCmd in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter" Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/cmd/cli/command/compose.go (1)
546-558: Nil pointer dereference: session will be nil after error fromnewCommandSessionWithOpts.The function returns
nilwhenLoadSessionfails. The code logs the error at line 550 but continues execution, unconditionally accessingsession.Provider(line 553),session.Loader(line 558), andsession.Stack(line 582), causing a panic.Either return after logging the error, check if
sessionisnilbefore using it, or ensurenewCommandSessionWithOptsalways returns a usable partial session.
Description
This PR solves a regression where we are exiting early with an error after failing to load a stack during
defang compose config. In this case, we want to only warn about the error, then continue.Linked Issues
Checklist
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.