[ 
https://issues.jenkins-ci.org/browse/JENKINS-7436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=158883#comment-158883
 ] 

Ross Aribi commented on JENKINS-7436:
-------------------------------------

I've implemented a solution to enable a user to test builds using a "shelved" 
changelist if desired. This isn't a plugin, but rather a process incorporated 
within the build request form in Jenkins (Parameterized build).

The Shelving process itself involves the following steps:
p4 unshelve -f -s ${SHELVED_CHANGELIST} ${sourceCodePath}
p4 revert -k ${sourceCodePath}

Where:
The -f flag forces the clobbering of any writeable but unopened files that are 
being unshelved. The -s flag specifies the number of the pending changelist 
that contains the shelved files.

So, my implementation in Jenkins is as follows:
1) Setup a parameterized build template
2) Add a string parameter to the build template and name it something like: 
SHELEVED_CHANGELIST
3) In the build section (I execute shell), put the following steps in the 
beginning of your build steps:

# Revert previous shelving activities
p4 revert ${sourceCodePath}

# Unshelve if true
if [ $SHELVED_CHANGELIST != "" ] ; then ( echo "User specified a shelved 
changelist, unshelving changelist ($SHELVED_CHANGELIST)";
p4 unshelve -f -s $SHELVED_CHANGELIST ${sourceCodePath};
)
else (
echo "Not running with a shelved changelist"; ); fi

# Now revert unshelve but KEEP the files locally
p4 revert -k ${sourceCodePath}

That's it. We've been using this solution successfully for about a year now and 
developers like it. All you need to do is to educate your developers on how to 
do shelving and create that changelist :)
                
> Add support for perforce shelve builds
> --------------------------------------
>
>                 Key: JENKINS-7436
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-7436
>             Project: Jenkins
>          Issue Type: New Feature
>          Components: perforce
>            Reporter: vbuzzsaw
>
> It would be really useful if the perforce plugin could add support for 
> shelving -- Functionality added perforce in version 2009.2.
> Here is a good blog writeup --http://blog.perforce.com/blog/?p=1872
> Many things hudson is great for is finding out if anyone "broke" the build by 
> polling source repositories looking for commits and kicking off builds.  But 
> breaking builds and backing code is a pain sometimes.  It would be even 
> better if you could run a build in hudson BEFORE checking in your changelist 
> to see if your changelist WOULD break the build and fix problems before they 
> occur.  That is exactly what perforce shelving does -- It allows you to 
> shelve your changelist -- saving all your modifications to the server 
> (without committing them), and then allowing others to pull down the shelved 
> modified code and perform a build.
> I'm not sure if the underlying tek42 perforce client library you use supports 
> shelving, but if so this would be really useful functionality.
> Thanks.
> Doug

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to