Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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. 

0 votes



3 answers

Permanent link
 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

0 votes

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. 


Permanent link
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.

0 votes


Permanent link

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}"
          }
      }
}

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019
× 151
× 74

Question asked: Oct 31 '13, 5:38 p.m.

Question was seen: 13,268 times

Last updated: Apr 26 '17, 12:49 p.m.

Confirmation Cancel Confirm