Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bounds to termHeight when BUILDKIT_TTY_LOG_LINES is set #4767

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ require (
github.com/tonistiigi/go-actions-cache v0.0.0-20240320205438-9794bdbb2fb4
github.com/tonistiigi/go-archvariant v1.0.0
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab
github.com/urfave/cli v1.22.14
github.com/vishvananda/netlink v1.2.1-beta.2
go.etcd.io/bbolt v1.3.9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ github.com/tonistiigi/go-archvariant v1.0.0 h1:5LC1eDWiBNflnTF1prCiX09yfNHIxDC/a
github.com/tonistiigi/go-archvariant v1.0.0/go.mod h1:TxFmO5VS6vMq2kvs3ht04iPXtu2rUT/erOnGFYfk5Ho=
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0=
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 h1:Y/M5lygoNPKwVNLMPXgVfsRT40CSFKXCxuU8LoHySjs=
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc=
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab h1:H6aJ0yKQ0gF49Qb2z5hI1UHxSQt4JMyxebFR15KnApw=
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc=
github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk=
github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA=
github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts=
Expand Down
2 changes: 2 additions & 0 deletions util/progress/progressui/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) {
v.jobCached = false
if v.term != nil {
if v.term.Width != termWidth {
termHeight = max(termHeightMin, min(termHeightInitial, v.term.Height-termHeightMin-1))
v.term.Resize(termHeight, termWidth-termPad)
}
v.termBytes += len(l.Data)
Expand Down Expand Up @@ -956,6 +957,7 @@ func setupTerminals(jobs []*job, height int, all bool) []*job {

numFree := height - 2 - numInUse
numToHide := 0
termHeight = max(termHeightMin, min(termHeightInitial, height-termHeightMin-1))
termLimit := termHeight + 3

for i := 0; numFree > termLimit && i < len(candidates); i++ {
Expand Down
6 changes: 5 additions & 1 deletion util/progress/progressui/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ var colorCancel aec.ANSI
var colorWarning aec.ANSI
var colorError aec.ANSI

var termHeight = 6
const termHeightMin = 6

var termHeightInitial = termHeightMin
var termHeight = termHeightMin

func init() {
// As recommended on https://no-color.org/
Expand Down Expand Up @@ -43,6 +46,7 @@ func init() {
if termHeightStr != "" {
termHeightVal, err := strconv.Atoi(termHeightStr)
if err == nil && termHeightVal > 0 {
termHeightInitial = termHeightVal
termHeight = termHeightVal
}
}
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/tonistiigi/vt100/vt100.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ github.com/tonistiigi/go-archvariant
# github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
## explicit
github.com/tonistiigi/units
# github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531
# github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab
## explicit; go 1.12
github.com/tonistiigi/vt100
# github.com/urfave/cli v1.22.14
Expand Down
Loading