promotion after completion of non-downstream job - jenkins

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.

Related

jenkins trying to copyArtifacts from a build that I trigger

I have installed the copyArtifacts plugin and created two freestyle jobs: experiment-main and experiment-1
experiment-1 just creates a file called artifact.txt with the build # in it, and archives it.
experiment-main triggers experiment-1 and then tries to copy the artifact like this:
but this is the result:
Running as SYSTEM
Building on master in workspace /var/lib/jenkins/workspace/experiment-main
Waiting for the completion of experiment-1
experiment-1 #4 started.
experiment-1 #4 completed. Result was SUCCESS
Build step 'Trigger/call builds on other projects' changed build result to SUCCESS
ERROR: Unable to find a build for artifact copy from: experiment-1
Finished: FAILURE
which isn't what I expected (or at least what I was hoping for)
I hoped it would find the experiment-1 build that was downstream from the current build.
Any ideas?
I figured out that there are variables with the numbers of triggered builds that I can use. To figure out the variable, I just printed all the environment variables with env and then found the right variable in the list.
Then I configured the copy artifacts plugin to use that build number.
I couldn't do it how #alex-o suggested, just getting the last build of the subjob, because I might have more than one job using the subjob at once, but if you don't have that problem, that might work for you.
Yes, this is unexpected behavior indeed.
The reason why this won't work is hidden in the help text of the "Upstream Project Name" input field:
Downstream builds are found using fingerprints of files. That is, a build that is triggered from a build isn't always considered downstream, but you need to fingerprint files used in builds to let Jenkins track them.
So, the Copy-Artifact plugin relies on fingerprint data to determine job ancestry. For that reason, you can not use the "Downstream build of..." feature using the current job as a parent: fingerprints are recorded in a post-build step, so an ongoing build of example-master does not have any fingerprints associated to it by the time it is looking for a matching build of experiment-1.
It is possible to modify fingerprint information at build run-time (e.g., via Groovy), but then, it's probably best to avoid the Copy-Artifact plugin entirely and to implement the whole procedure in Groovy right away.
Your best bet is probably to refer to example-1 via "Last successful build" and to ensure that this is the build that you triggered before (usually this will be correct, but depending on your setup there can be race conditions).

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}

Unifying Jenkins console logs

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.

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.

Jenkins CI build timeout for long processes

We're using Jenkins CI (version 1.454) as execution engine for automated tests (triggered via Ant). One of my tests runs for at least 1-2 days. I couldn't exactly find out, since Jenkins always terminates my test before it finishes. Last time after ~20,5h.
We got the "Build timeout" plugin installed, but the test project in question doesn't have a timeout configured, so it shouldn't interrupt. The tests are running on a slave node. The global Jenkins configuration does not contain any timeout settings.
I've seen two other people having a similar problem, but no answers so far
Stacktrace:
INFO: Test-Linux-lts-mc #31 aborted
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at hudson.remoting.Request.call(Request.java:127)
at hudson.remoting.Channel.call(Channel.java:681)
at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:158)
at $Proxy37.join(Unknown Source)
at hudson.Launcher$RemoteLauncher$ProcImpl.join(Launcher.java:859)
at hudson.Launcher$ProcStarter.join(Launcher.java:345)
at hudson.tasks.Ant.perform(Ant.java:217)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:473)
at hudson.model.Run.run(Run.java:1408)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)
The console log doesn't show any indication to an error or timeout. It just says Build aborted and cleans up the nodes workspace.
Jenkins itself does not have a timeout. I have 24 hour performance tests and Jenkins does not abort them.
The java.lang.InterruptedException makes me think there is a signal from your build process which escapes and hits Jenkins. Are you running ant target using the Invoke Ant build step? If you are, you could try to execute a shell build step and in the shell run ant yourtarget.

Resources