Jenkins Plugin - how to deliver the snapshot that is created in the workspace to the stream automatically?
Hi,
We are using RTC SCM. We a a build definition and the Jenkins plugin configured to build the code. As you know, every time the build runs, a snapshot is created in the workspace associated with the build definition.
We need to have that snapshot in the stream rather than in the workspace. Is it possible to deliver the snapshot that is created in the workspace to the stream automatically?
Is there a better way to do it than using the CLI?
I´l appreciate your help.
3 answers
There is a post-build deliver option in the Hudson build definition that will deliver everything from the workspace to a stream. I don't if it necessarily is better than the CLI, but it is an option.
~Spencer
Comments
The only option besides command line that I am aware of is even worse - the GUI. I don't have the reputation points to upvote this question, but I've been wondering the same thing for years.
It would be great to have a Post-Build option to deliver the snapshot to the stream. Doing it manually is a pain and error prone, and leaving the snapshot in the build workspace doesn't make sense to me.
It would be great to have a Post-Build option to deliver the snapshot to the stream. Doing it manually is a pain and error prone, and leaving the snapshot in the build workspace doesn't make sense to me.
Due to the lack of missing support from the Jenkins RTC plugin I managed to do this step with the cmd line client.
I'm using a temporary workspace do deliver the snapshot.
The following groovy code is used to define the jenkins pipeline :
node {
stage('SCM Deliver')
{
/
Jenkins job parameters:
sourceStreamSnapshot : The RTC snapshot name or UUID of the source stream which should be checked out.
targetStream : The RTC name or UUID of the target stream. So the checkout snapshot will be delivered to this given stream
/
/
RTC SCM documentation:
https://www.ibm.com/support/knowledgecenter/SSYMRC_5.0.1/com.ibm.team.scm.doc/topics/r_scm_cli_scm.html
/
/
Persisting login details:
1. cd /jazz/scmtools/scm
2. ./scm login -r https:/your.rtc.com/ccm/ -u builduser -p <PASSWORD> -c
3. after this step you should find a repository.xml in the following dir :/home/<user>/.jazz-scm . it contains the encrypted login configuration
/
// Build workspace is the temporary workspace
def buildWorkspace = "JenkinsPostDeliverTempWorkspace${BUILD_NUMBER}"
// List of the components which should be delivered
def streamComponentList = "MY_COMP"
// RTC Url
def repoUrl = "https:/your.rtc.com/ccm/"
// RTC cmdline path
def rtcCmd = "/jazz/scmtools/scm"
echo "Create temporary workspace"
sh "${rtcCmd} create workspace -r ${repoUrl} --snapshot '${sourceStreamSnapshot}' ${buildWorkspace}"
try{
sh "${rtcCmd} deliver -r ${repoUrl} -C ${streamComponentList} -s '${buildWorkspace}' -t '${targetStream}' -v"
}catch(Exception e){
echo ${e}
}finally{
sh "${rtcCmd} delete workspace -r ${repoUrl} ${buildWorkspace}"
}
}
}