Skip to content

Conversation

mikemccracken
Copy link
Contributor

What type of PR is this?

This is a feature Pull Request.

Which issue does this PR fix:

when passing --debug, errors have a ton of extra stack frames in the backtraces that are never useful.

What does this PR do / Why do we need it:

this makes looking at error backtraces nicer. We need it because nobody's eyes are getting younger out here.

If an issue # is not available please add repro steps and logs showing the issue:

Try a stacker command that will fail, and then squint!

Testing done on this change:
LOOK:

we went from this:

$ ./stacker --debug build -f fugazi.yaml
error: open fugazi.yaml: no such file or directory
couldn't read stacker file
stackerbuild.io/stacker/pkg/types.NewStackerfile
        /stacker-tree/pkg/types/stackerfile.go:192
stackerbuild.io/stacker/pkg/types.NewStackerFiles
        /stacker-tree/pkg/types/stackerfiles.go:23
stackerbuild.io/stacker/pkg/stacker.(*Builder).BuildMultiple
        /stacker-tree/pkg/stacker/build.go:614
main.doBuild
        /stacker-tree/cmd/stacker/build.go:119
github.com/urfave/cli/v2.(*Command).Run
        /stacker-tree/.build/gopath/pkg/mod/github.com/urfave/cli/v2@v2.27.6/command.go:276
github.com/urfave/cli/v2.(*Command).Run
        /stacker-tree/.build/gopath/pkg/mod/github.com/urfave/cli/v2@v2.27.6/command.go:269
github.com/urfave/cli/v2.(*App).RunContext
        /stacker-tree/.build/gopath/pkg/mod/github.com/urfave/cli/v2@v2.27.6/app.go:333
github.com/urfave/cli/v2.(*App).Run
        /stacker-tree/.build/gopath/pkg/mod/github.com/urfave/cli/v2@v2.27.6/app.go:307
main.main
        /stacker-tree/cmd/stacker/main.go:352
runtime.main
        /stacker-tree/.build/gopath/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.7.linux-amd64/src/runtime/proc.go:272
runtime.goexit
        /stacker-tree/.build/gopath/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.7.linux-amd64/src/runtime/asm_amd64.s:1700
error: exit status 1
stackerbuild.io/stacker/pkg/container.MaybeRunInNamespace
        /stacker-tree/pkg/container/userns.go:102
main.main.func3
        /stacker-tree/cmd/stacker/main.go:347
github.com/urfave/cli/v2.(*Command).Run
        /stacker-tree/.build/gopath/pkg/mod/github.com/urfave/cli/v2@v2.27.6/command.go:216
github.com/urfave/cli/v2.(*App).RunContext
        /stacker-tree/.build/gopath/pkg/mod/github.com/urfave/cli/v2@v2.27.6/app.go:333
github.com/urfave/cli/v2.(*App).Run
        /stacker-tree/.build/gopath/pkg/mod/github.com/urfave/cli/v2@v2.27.6/app.go:307
main.main
        /stacker-tree/cmd/stacker/main.go:352
runtime.main
        /stacker-tree/.build/gopath/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.7.linux-amd64/src/runtime/proc.go:272
runtime.goexit
        /stacker-tree/.build/gopath/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.7.linux-amd64/src/runtime/asm_amd64.s:1700

to this

$ ./stacker --debug build -f fugazi.yaml
stacker version v1.1.0-rc3-1-g0c78c6e-dirty
usernsexec-ing [u 0 1000 1 1 100001 655359 g 0 1000 1 1 100001 655359 -- /home/embrane/ssd/stacker/stacker --internal-userns --debug build -f fugazi.yaml]
stacker version v1.1.0-rc3-1-g0c78c6e-dirty
no previous storage type detected
initializing stacker recipe: fugazi.yaml
Error: couldn't read stacker file: open fugazi.yaml: no such file or directory
stackerbuild.io/stacker/pkg/types.NewStackerfile
        /stacker-tree/pkg/types/stackerfile.go:192
stackerbuild.io/stacker/pkg/types.NewStackerFiles
        /stacker-tree/pkg/types/stackerfiles.go:23
stackerbuild.io/stacker/pkg/stacker.(*Builder).BuildMultiple
        /stacker-tree/pkg/stacker/build.go:614
main.doBuild
        /stacker-tree/cmd/stacker/build.go:119
Error: exit status 1
stackerbuild.io/stacker/pkg/container.MaybeRunInNamespace
        /stacker-tree/pkg/container/userns.go:102
main.main.func3
        /stacker-tree/cmd/stacker/main.go:347

Automation added to e2e:

nah.

Will this break upgrades or downgrades?

If it does I will be surprised and disappointed.

Does this PR introduce any user-facing change?:

Not one that anyone needs to be warned about, no

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Yeah I do!

error exits with --debug include a bunch of urfave frames that are just
clutter, let's ignore them.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 55.55556% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.41%. Comparing base (0c78c6e) to head (f55df43).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/stacker/main.go 55.55% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #717      +/-   ##
==========================================
- Coverage   60.47%   60.41%   -0.06%     
==========================================
  Files          59       59              
  Lines        6477     6488      +11     
==========================================
+ Hits         3917     3920       +3     
- Misses       1912     1920       +8     
  Partials      648      648              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mikemccracken mikemccracken merged commit bceba25 into project-stacker:main Aug 22, 2025
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants