6

I have a Jenkins (which I'm new to) system that has a few constraints imposed on it:

  • master/slave arrangement
  • slave is Windows 7
  • installing plugins is likely to experience significant resistance
  • builds are to be archived to a Windows share

The goal is to have the output of the build and the log of the build archived to:

//server/share/archive/%BUILD_TAG%/

I'm using the post-build step Send build artifacts to a windows share to push the binaries to the archiving server, but I've yet to find a way to arrange for the build log to end up there too. I have discovered that the console output is available at http://jenkins/job/$jobTitle/$buildNumber/consoleText, but I'm not sure how useful that is going to be - I can't cause anything to run on the archive server to run. I'd like to maintain the separation that the master Jenkins knows about the slave and the archive, but the slave and archive are unaware of each other (that's assuming the Send build artifacts... step is running on the master rather than being pushed down to the slave to action).

Another approach I explored was to have Jenkins store the artifacts locally (via Archive the artifacts), but then I don't see a way to promtply push the result + log to the external server.

It seems that Jenkins is very flexible and that this scenario is likely already catered for, but I've yet to find out how.

1 Answer 1

3

Using the Post Build Task plugin, you can get the console output with a wget command:

wget -O console-output.log ${BUILD_URL}consoleText
7
  • I ended up with a sequence of post-build actions in order to capture as much output as possible in the log - 'Send build artifacts to a windows share', then 'Execute a set of scripts' with a build step of 'Execute Windows batch command' to call the wget, followed by a second 'Send files to a windows share' for just the log. That meant the initial archiving was in the captured log.
    – Chris
    Jul 9, 2015 at 9:42
  • This just sounds like a bad idea to me. I would expect Jenkins to have a way to copy that file without all these shenanigans. Using wget to pull the log from the current job? Really? :) If I were a Java programmer, I think I'd have a plugin coded for that real soon now.
    – Beirdo
    Nov 17, 2015 at 23:55
  • Since a few days, I'm using this Jenkins plugin (you have to build it yourself): github.com/cboylan/jenkins-log-console-log. It's working well. Nov 18, 2015 at 7:40
  • I Just don't like to have plugin dependency, yes you can find a good one doing this for you, but every jenkins update you will check his it is still working.. the wget wont change in every case...Copy artifact plugin is a good choice, because it is a stable one.. but if i should use a plugin for every specific need i've to accomplish, it will be a mess, Jenkins will be slower and heavy, and i should check the compatibility at every update... think at this Beirdo.. Jun 14, 2016 at 10:50
  • 1
    @kayleeFrye_onDeck I've followed this procedure: wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial Nov 15, 2016 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.