Jenkins Plugin - how to deliver the snapshot that is created in the workspace to the stream automatically?
3 answers
Comments
Spencer, as far as I understand, the post-build deliver option replaces the whole stream component with the workspace component. This is not a valid solution since meanwhile the build is running, new change sets may be deliver to the stream, and those change sets would be "removed" by the post-build deliver option from the stream.
wouldn't that happen regardless? any changes not processed by this snapshot would be lost if you re-insert the snapshot into the stream.
can u explain why you want to do this?
What I need is that the created baseline are shown from the Stream's baseline history. Delivering a baseline doesn't replace any not processed change sets. When you deliver a baseline you only make that baseline visible from the Stream.
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.
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}"
}
}