cliffano / nestor

Jenkins CLI and node.js client
http://blog.cliffano.com/tag/nestor/
MIT License
182 stars 27 forks source link

Add console output stream feature #6

Closed cliffano closed 11 years ago

cliffano commented 12 years ago

A feature to stream console output to the terminal, e.g. nestor console foo, would reduce the need to switch between terminal and browser.

[07:48] <+cliffano> kohsuke: is console output stream of a running build accessible via jenkins remote access api? [07:49] == jyr_ [~jyr@ec2-50-18-47-76.us-west-1.compute.amazonaws.com] has joined #jenkins [07:49] @kohsuke kind of, but not very easy [07:49] @kohsuke the client has to do the bookkeeping of the byte count [07:49] @kohsuke CLI does this already for you with "build -v" [07:50] @kohsuke What are you trying to use this for? [07:50] @kohsuke maybe we can do this for REST API, too [08:14] <+cliffano> kohsuke: i'm trying to display the console output on the command line... for convenience, so one does not have to leave the terminal .. i.e. trigger build from command line, display console output stream of the latest build.. switch to the next window and continue coding while the output keeps streaming.. [08:14] <+cliffano> kohsuke: i'd like to add such feature to http://github.com/cliffano/nestor .. so i can do 'nestor build foo', then 'nestor console foo' [08:15] @kohsuke right, ok [08:15] @kohsuke so you might be actually willing to do the byte counting [08:16] <+cliffano> kohsuke: yup.. i guess as long as there's a stream i can tap to, then nestor would be able to muck around with it.. [08:16] @kohsuke you basically GET to http://ci.jenkins-ci.org/job/libs_svnkit/11/logText/progressiveText [08:17] @kohsuke with start=N indicating the byte count to retrieve from [08:18] @kohsuke e.g., ?start=100 [08:18] @kohsuke the respond will contain X-Text-Size header that you should add to N before sending the next request [08:18] @kohsuke if the data is still being sent you get X-More-Data header set to true [08:19] @kohsuke that's your cue to hit the same URL again after some delay with new start=N [08:23] <+cliffano> kohsuke: is there an alias that points to the latest build, i.e. instead of build number 11 in the sample url [08:23] <+cliffano> i tried http://ci.jenkins-ci.org/job/libs_svnkit/latest/logText/progressiveText , no luck [08:23] @kohsuke http://ci.jenkins-ci.org/job/libs_svnkit/lastBuild/ [08:23] @kohsuke see "permalinks" in http://ci.jenkins-ci.org/job/libs_svnkit/ [08:24] <+cliffano> kohsuke: awesome... thanks a lot for the pointers, that should be good to get me started. much appreciated :) [08:41] @kohsuke cliffano: documented what we just talked about [08:41] @kohsuke thanks for driving this [08:42] @kohsuke https://github.com/jenkinsci/jenkins/commit/bd0063e35174b4b53110fa0f92f6913d0049e91c

cliffano commented 11 years ago

Released in v0.0.9 .

$ nestor console