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

Fix tty:true containers. Add GHA push workflow. #1

Merged
merged 5 commits into from
Apr 15, 2024
Merged

Conversation

kanaka
Copy link
Member

@kanaka kanaka commented Apr 12, 2024

No description provided.

kanaka added 2 commits April 11, 2024 17:51
Instead of having the examples invoke nbb from the node_modules
directory and specifying a classpath and main function, use the dcmon
wrapper which constructs the equivalent command line.
For containers that have an attached TTY (Config.Tty: true), the format
of the stream data is different and was breaking the log stream method
we were using. For non-TTY containers, the log stream send chunks with
an 8 byte frame header that specifies the type of chunk buffer (stdout or
stderr) and the chunk length/size. The dockerode modem.demuxStream
method is used to split the chunks into seperate stdout and stderr
streams. For TTY enabled containers, the chunks have no framing and are
just raw log chunk buffers. Using the same method with TTY streams
causes the demuxStream function to effectively wait forever because the
length of the first "frame" tends to be very large (whatever random
4 bytes of ASCII characters are sent at the start of the log).

To fix this we check the inspected container data for the Config.TTY
property and if it's set we just pipe the log stream from the container
to our output stream that we use for scanning.
@kanaka kanaka force-pushed the fix-tty-containers branch 3 times, most recently from 8f331bc to 51647c6 Compare April 12, 2024 14:45
@kanaka kanaka requested review from abrooks and jonsmock April 12, 2024 14:46
on:
push: {}
pull_request:
branches: [ master ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/master/main/

@kanaka kanaka force-pushed the fix-tty-containers branch from 51647c6 to 3ad81ff Compare April 15, 2024 15:42
@kanaka kanaka merged commit 254f5cf into main Apr 15, 2024
2 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