jenkins in the shell

109 views
Skip to first unread message

Greg Mattson

unread,
Jan 6, 2016, 8:38:20 PM1/6/16
to Jenkins Developers
All,

I'd very much like to take the monitoring of my jenkins processes into the shell:

1. ability to attach to a tmux session and script it so that each new node's jobs are listed there
2. ability to be stateless and have the logger on the unix server
3. ability to share the output of logs with other users (again via tmux's screen sharing mechanism).

However, looking into it, jenkins is really frustrating my intentions here. 

First I thought I'd do the simple thing, namely wget on consoleText in a loop, and then append the delta to an output log. But apparently consoleText trucates the lines at the first 10000(!) and then doesn't even progress.

Second I thought that I might go onto the executor, and find the file that slave.jar is outputting to locally before it sends data to the jenkins master. But apparently there is no such file.

Third, I thought I might eavesdrop on the port that slave.jar is using, but again, it looks like there is no such port that slave.jar uses (instead opting for a pipe(?))

Fourth I thought I might look at consoleFull, but that is all wrapped in AJAX and therefore is hard to tap into via a command line utility.

Fifth I thought I might inject my own slave.jar (since I don't control the master jenkins implementation and cannot update it) but i'm not sure if this can even be done, nor the process for compiling my own slave.

Anyways, I'm rapidly running out of bullets here. I really don't like the necessity of clicking on multiple projects just to see what is happening - I'd much rather be able to see it all in a tmux session so I can have a program spawn a shell with a tail on that node, and proceed to monitor whats going on in each window of the tmux session. 

so how do you do this? what api call exists so that you can just get the latest <number> of lines in a given output file rather than the whole thing, and get it in such a format that you can use curl or wget to access it?

Or is there a workaround that I haven't thought of here?

Thanks much for any info.


Robert Sandell

unread,
Jan 7, 2016, 6:33:57 AM1/7/16
to jenkin...@googlegroups.com
I guess it should be quite easy to write a plugin with a CliCommand that just calls Run.writeWholeLogTo.

/B

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c72621a8-37ab-4893-821b-f73bcd39e71e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

Greg Mattson

unread,
Jan 7, 2016, 2:26:01 PM1/7/16
to Jenkins Developers


On Thursday, January 7, 2016 at 3:33:57 AM UTC-8, Robert Sandell wrote:
I guess it should be quite easy to write a plugin with a CliCommand that just calls Run.writeWholeLogTo.


yes, unfortunately, we don't have authority to add plugins to our jenkins framework. And the tools group is reluctant to upgrade to the latest version.

It really, really sucks not having any control over the environment - so the only thing I can see is modifying the slave in place, on the nodes, in such a way that restarting the slave points to this modified slave rather than to the one provided by the server.

What I basically want is a way for this slave to mirror the text that it sends back to the master, and output it non-blocking to a unique file.

Where would I start on this? Is it possible to use a customized slave like this? Which source code would you modify/compile?

Thanks much..

Stephen Connolly

unread,
Jan 8, 2016, 3:29:52 AM1/8/16
to jenkin...@googlegroups.com
if they've upgraded to the latest security releases then it *should* be impossible to run such a modified slave (though I suspect you could have a "listen" behaviour if you used a Java agent... But that would only apply if you can control the java command used to launch the slave. With JDK auto-install that would be non-possible)
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/38c8a62a-f850-43a6-809f-e71377919a21%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Sent from my phone
Reply all
Reply to author
Forward
0 new messages