Jenkins Build connected to RTC using JenkinsFile creates two build results when polled from Jenkins
Hello,
I am using the workaround documented here, but it generates two results one with the work items containing the changes and one with all the stuff I return to it. I am using the work around for getting a lightweight checkout when using RTC detailed here:-
This means I run a checkout command twice, but the second command shouldn't generate a build result, it uses the snapshot generated by the lightweight checkout, not sure it is the cause of the issue or simply down to a bug concerning the combination of Jenkins polling and JenkinsFile.
Anyone else had this issue, is there a workaround?
Works OK when the build is initiated from RTC.
Cheers
Richard
2 answers
Hi Lakshmi,
Thanks for your reply
Not enough characters to add this as a comment
Note that in order to recreate this problem the build must be initiated from Jenkins, it only generates one build result when initiated from RTC, the following is the relevant part of my jenkins file. The polling for changes to achieve continuous integration must be setup in Jenkins, doesn't work properly from RTC.
//The following is a workaround for light checkout not working in RTC
//what we do here is define a load rule in our build definition that just returns the filse in the build folder
//then checkout the snapshot made of all components in the cas of a regular build
def checkOutVars
if ("${env.personalBuild}" == "true") { // This is true when a personal build is started from RTC.
echo "Checking out the build definition in node"
checkOutVars = checkout([$class: 'RTCScm', avoidUsingToolkit: false, buildTool: 'RTC 6.0.4', buildType: [buildDefinition: 'Experimental PCU-TSS build', customizedSnapshotName: '', value: 'buildDefinition'], credentialsId: '01c78c54-715c-4302-b68c-cfb7fb51f91a', overrideGlobal: true, serverURI: 'server', timeout: 480])
}
else { // Otherwise we checkout the snapshot created by the Pipeline Script from SCM's checkout.
echo "Checking out a snapshot in node"
checkOutVars = checkout([$class: 'RTCScm', avoidUsingToolkit: false, buildTool: 'RTC 6.0.4', buildType: [buildSnapshot: "${env.team_scm_snapshotUUID}", buildSnapshotContext: [snapshotOwnerType: 'none'], currentSnapshotOwnerType: 'none', loadDirectory: '.', value: 'buildSnapshot'], credentialsId: '01c78c54-715c-4302-b68c-cfb7fb51f91a', overrideGlobal: true, serverURI: 'server', timeout: 480])
}
Comments
Note that before I read your post, I was using the skipDefaultCheckout() option and running the whole thing in the script directory to get around the double checkout issue, might return to that idea, feels like a frig though. Any downside to this other than the ugliness?
pipeline {
agent any
options {
//This is a sort of frig to avoid checking everything out twice
//We want this script to be under change control like everything else
//but when you use the pipeline and get script from scm option in RTC it
//gets absolutely everything into a workspace@script folder you cannot stop that
//you can however stop the secongd checkout to the workspace folder by using the
//skipDefaultCheckout option, this seems to work and just means you run everything
//from the script folder, looks and feels like a frig though
//There is no way of stopping the system checking everything out twice when using
//RTC and the pipeline script from SCM with a build definition other than this way I think
//So the files are loaded into $workspace@script directory and built there
//Also note that a "." should be placed into the load directory in the build definition
//configuration otherwise this JenkinsFile cannot be found, you can reference it relative to the
//root of the jenkins workspace
skipDefaultCheckout()
}
Comments
Sridevi Sangaiah
JAZZ DEVELOPER Jul 10 '19, 6:58 a.m.Richard Good
Jul 10 '19, 7:05 a.m.Richard Good
Jul 15 '19, 4:20 a.m.Lakshmi Narasimhan T V
JAZZ DEVELOPER Jul 15 '19, 5:03 a.m.