Unifying Jenkins console logs - jenkins

We have a nightly build of our projects and each of them has several downstream jobs, and I configured Jenkins to send the build logs when the main job ends. The problem is that the main console only shows the details of its own job, and from the downstream jobs it shows this:
Waiting for the completion of "Project BBB"
"Project BBB" #41 completed. Result was SUCCESS
Is there any way I could make it show the details of the downstream jobs?
Started by upstream project "Project AAA" build number 38
originally caused by:
Started by user "User Name"
Building in workspace C:\WORKSPACE\Project BBB
Reverting C:\WORKSPACE\Project BBB\. to depth infinity with ignoreExternals: true
Updating https://111.111.111.111/svn/Project BBB at revision '2014-10-10T11:00:11.785 +0100'
At revision 43143
no change for https://111.111.111.111/svn/Project BBB since the previous build
Notifying upstream projects of job completion
Finished: SUCCESS
Or at least send the downstream jobs build.log also?

The build log of each completed job is available in plain text:
http://<jenkins_server>/job/<job_name>/<job_number>/consoleText
In your downstream job, you can pull this log into a file, and simply cat it out in the downstream's console log.

Related

Jenkins: Mark build as success if the last step succeded even if a previous step was unstable

I've in jenkins a flow like this:
Wrapper Job1
Trigger Job2
(Conditionally) if the job 2 is unstable it triggers the Job3
Below you can see JOB1 (wrapper) configuration pics:
JOB2 trigger configuration :
JOB3 conditional trigger configuration
Now, to give you a little bit of context:
I'm running tests with selenium and cucumber, these tests can randomly fail and if they fail, the job2 is marked unstable (if not the wrapper just finish with success status), in case the job2 fails will be triggered the job3, this is a "RERUN FAILED TESTS" task, then obviously in the case this last will be completed with success I want the wrapper to be marked as SUCCESS.
This should be really easy, but it's not working, below the wrapper (JOB1) jenkins job log:
FIRST STEP (JOB2) UNSTABLE BECAUSE SOME TESTS FAILED:
Waiting for the completion of REM_Parallel_Tag_Sub_Runner
REM_Parallel_Tag_Sub_Runner #9 completed. Result was UNSTABLE
Build step 'Trigger/call builds on other projects' changed build result
to **UNSTABLE**
IF THE JOB2 IS UNSTABLE THE WRAPPER TRIGGER THE JOB 3:
[Current build status] check if current [UNSTABLE] is worse or equals then
[UNSTABLE] and better or equals then [UNSTABLE]
Run condition [Current build status] enabling perform for step [BuilderChain]
Waiting for the completion of REM_Parallel_Sub_ReRuns
THE JOB 3 SUCCEEDED, THIS MEANT THAT THE TESTS THAT WERE FAILING NOW ARE SUCCEEDING, AND I WANT THAT THIS STEP UPDATE THE JOB1 FROM UNSTABLE TO SUCCESS, IT SHOULD BE A NORMAL BEHAVIOUR
REM_Parallel_Sub_ReRuns #6 completed. Result was SUCCESS
[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] Copying all json files from: /PATH/workspace /TiaCukes to reports directory: /PATH/cucumber-html-reports
[CucumberReportPublisher] there were no json results found in: /u01/app/build/jenkins/jobs/REM_Parallel_Tag_Runner_Orchestrator/builds/9/cucumber-html-reports
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
No emails were triggered.
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: UNSTABLE
AS YOU CAN SEE THE BUILD STATUS HAS NOT BEEN UPDATED, EVEN IF THE LAST TRIGGERED STEP SUCCEEDED, THE BUILD STATUS REMAINS UNSTABLE
How can i fix it? Should not be so hard goal to accomplish!
Thanks a lot!
Resolved with the use of variables set by Parameterized Trigger Plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin
Pics below:
JOB2 trigger configuration:
JOB3 conditional trigger configuration:
Feel free to ask about details

Jenkins matrix job not triggering multiple downstream jobs

I've configured a Jenkins matrix job that has a total of 4 axis points. For each axis there is a single build step (parameterized-trigger) triggering another project adding the current build parameters. All four jobs are triggering the same job with different parameters.
The problem I am seeing is only one drown stream job gets executed, I would expect 4.
This is NOT a post-build task, it is setup as a build step. This is the description in the Parameterized Trigger Plugin wiki page:
Build step
When using the trigger parameterized build as a buildstep
it will be called for every different configuration, so if triggering
another project with no parameters it will be done the same number of
times as you have configurations, possible causing the triggered job
to run more than once.
However this also allows you to trigger other jobs with parameters
relating to the current configuration, i.e. triggering a build on the
same node with the same JDK.
This is the log entry for the downstream job, it shows all for triggers, but they all seem to be launching the same exact job:
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x/ProductType=video,SecurityType=standard" build number 12
originally caused by:
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x" build number 12
originally caused by:
Started by user anonymous
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x/ProductType=video,SecurityType=secure" build number 12
originally caused by:
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x" build number 12
originally caused by:
Started by user anonymous
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x/ProductType=voice,SecurityType=standard" build number 12
originally caused by:
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x" build number 12
originally caused by:
Started by user anonymous
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x/ProductType=voice,SecurityType=secure" build number 12
originally caused by:
Started by upstream project "AndroidLibraries_Mx_Branch_5_1_x" build number 12
originally caused by:
Started by user anonymous
[Pipeline] node
Running on master in /var/lib/jenkins/workspace/AndroidLibrary_pipeline
<... job details ... >
If it makes any difference, the downstream job is a pipeline job as noted by the name.
Jenkins 2.19.2
Matrix Plugin 1.7.1
Parameterized Trigger Plugin 2.32
Pipeline 2.4
I've done a good bit of searching, and while I found a similar issue, the accepted answer does not help.
I figured it out. The parameters were not being passed correctly to the child job. I had the "Current build parameters" option set in the trigger parameterized job set, but I had to add "Predefined parameters" also, adding the parameters that the child job was expecting.
SecurityType=${SecurityType}
ProductType=${ProuductType}

Why doesn't Jenkins stop processing after a failed build step?

I'm running into an issue where Jenkins is continuing on to subsequent build steps even when the prior build step has failed. This is for setting up a Jenkins free-style job.
The build steps I'm running into an issue with are for "Trigger/call builds on other projects" steps, I am selecting/checking the option for "Block until the triggered projects finish their builds" and setting the parent job to mark the build result the same as the triggered jobs.
So say I have Job_1, Job_2, and Job_3 scheduled in sequence using the above options. Job_1 passes just fine, then Job_2 fails. In the Jenkins logs it shows Job_2 failing and marking the parent job as failed. However, the parent job still continues on to Job_3 even after marking itself as failed.
Here's an example from the Jenkins console output; notice how Job_2 failed and build result was changed to failure, but 1 second later Jenkins still kicks of Job_3 even though the build is already marked as failure:
12:34:54 Waiting for the completion of Job_1
12:48:44 Job_1 #7 completed. result was SUCCESS
12:48:44 Build step 'Trigger/call builds on other projects' changed build result to SUCCESS
12:48:45 Waiting for the completion of Job_2
18:18:44 Job_2 #169 completed. result was FAILURE
18:18:44 Build step 'Trigger/call builds on other projects' changed build result to FAILURE
18:18:45 Waiting for the completion of Job_3
18:38:25 Job_3 #180 completed. result was SUCCESS
It turns out the issue is with the trigger parameterized builds plug-in. For some reason they thought it would be a good idea to continue on to subsequent build steps even if a build step that is a blocking call fails and calls the invoking parent job to fail.
Looks like I gotta do things myself or switch to Bamboo...

promotion after completion of non-downstream job

My question is somewhat continuation of Cloudbees jenkins does not trigger jobs on promotion. To recap: I am using jenking on cloudbees. I have a job named "package" with a couple of promotion processes. The first promotion process "promote to e2etesting" is configured as: promote after job named "testing" is successfully run. "Testing" is configured as downstream job of "package" job (build other project of post build action section). This promotion works nicely and as soon as "promote to e2etesting" is performed a new job named "e2e-testing" is fired.
My "package" job has other promotion processes, one of them being named "promotion-to-staging" with criteria being : "when the following downstream projects build successfully: e2e-testing". Unfortunately after successful completion of "e2e-testing" (triggered by "promote to e2etesting"), "promotion-to-staging" does not happen.
On "e2e-testing" job console output i can see:
WARNING: package appears to use this job as a promotion criteria, but no fingerprint is
recorded. Fingerprint needs to be enabled on both this job and package.
See http://hudson.gotdns.com/wiki/display/HUDSON/Fingerprint for more details
I have no idea if the warning is related to my problem but on the other side it is weird since i have "record fingerprint of files ..." enabled for "e2e-testing job", and "package" job (being maven job) seems to have it enabled out-of-box - as i click on "passport icon" on artifact built by "package" job i can see it utilization among other jobs.
In jenkins logs i can see:
SEVERE: I/O error in channel s-74638b6e
java.io.IOException: Unexpected termination of the channel at
hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at hudson.remoting.Command.readFrom(Command.java:92)
at hudson.remoting.ClassicCommandTransport.read(ClassicCommandTransport.java:59)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
May 24, 2013 3:43:31 AM hudson.model.Run execute
INFO: e2e-testing #10 main build action completed: SUCCESS
May 24, 2013 3:43:19 AM hudson.slaves.WorkspaceList log
FINE: Executor #0 for s-74638b6e : executing e2e-testing #10 acquired /scratch/jenkins/workspace/e2e-testing
May 24, 2013 3:43:14 AM hudson.model.Run execute
INFO: package » promotion » promotion-to-e2e-testing #10 main build action completed: SUCCESS
Any idea?
e2e-testing need not be a configured downstream job of package (i.e. kicked off directly as a post-build action), but there need to be a downstream relationship between the builds as identified by fingerprints. In other words, some (successful) build of e2e-testing must record a fingerprint of an input artifact which matches the fingerprint of an artifact produced by some build of package. When that happens, promotion-to-staging should be triggered on that build of package.
Given the warning message you saw, I suspect that e2e-testing either does not record fingerprints, or is recording fingerprints but none matching an artifact produced by package. You should be able to check this by browsing the Fingerprints link for a successful e2e-testing build, verifying that the expected artifact is listed, then clicking on details for that artifact and verifying that it is also listed as being “produced” by a package build.

Cloudbees jenkins does not trigger jobs on promotion

I am trying to follow one of Koshuke's apporaches to organize my builds by using job-promotion on cludbees dev#cloud. In his presentation everything worked as a charm (beside running his examples from his own Jenkins instance deployed on localhost and me running jenkins jobs in dev#cloud).
Basically i have a couple of jobs and my main job called package within folder joy defines promotion process named "promotion-to-e2e-testing" (with criteria being completion of one of downstream jobs and no extra action defined for promotion). From the jenkins dashboard i can see that this promotion was successful. Nevertheless a job (called e2e-testing within folder joy) being configured with trigger "Build when another project is promoted : Job name: "joy/package", Promotion: "promotion-to-e2e-testing" is not fired !
I have looked at jenkins systems logs (via cloudbees Manage Jenkins link) and i can see:
May 20, 2013 6:04:33 AM hudson.remoting.SynchronousCommandTransport$ReaderThread run SEVERE: I/O error in channel s-8770fc61
java.io.IOException: Unexpected termination of the channel
athudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50) Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at hudson.remoting.Command.readFrom(Command.java:92)
at hudson.remoting.ClassicCommandTransport.read(ClassicCommandTransport.java:59)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)May 20, 2013 6:04:26 AM hudson.model.Run execute
INFO: joy » package » promotion » promotion-to-e2e-testing #5 main build action completed: SUCCESS
May 20, 2013 6:04:26 AM hudson.slaves.WorkspaceList log
FINE: Executor #0 for s-8770fc61 : executing joy » package » promotion » promotion-to- e2e-testing #5 acquired /scratch/jenkins/workspace/joy/package
May 20, 2013 6:04:25 AM hudson.slaves.ChannelPinger setUpPingForChannel
By reading from the bottom to the top it seems that SynchronousCommandTransport is thrown after successful promotion. To make sure that throwing the exception is not volatile i have run my jobs a couple of times but still see the same exceptions in logs and my e2e-testing job is not fired.
Anyone can help me with that ? Maybe triggering a jobs by promotion is not available on cloudbees? Or maybe it is because my jobs are stored in a jenkins folder (all jobs being in a single folder) ?
configured with trigger Build when another project is promoted: Job name: joy/package
I suspect you have hit one of the symptoms of JENKINS-17955. If my hypothesis is correct, joy » package will work as the upstream name even though joy/package is really what the plugin ought to be expecting. But I have not yet dug further and tried to reproduce and fix it.

Resources