Jump to content
Gwanhir

External tool for Jenkins automation

Recommended Posts

Hello,

I have tow questions :

1- Is there a way to add on an external tool called from a changeset, the branch it depends on? Or to retrieve it from the command line? I have the following setup on externaltools.conf :

branch | Create new build | "<path to the exe>" | "branch=@object&repository=@repository"
changeset | Create new build | "<path to the exe>" | "changeset=@object&repository=@repository"

This will call a  custom tool I wrote in C# to start builds on our Jenkins. The arguments for this tool will be used to pre-fill the plastic related stuff. I already implement an argument less version that retrieve repositories, branches and changesets using the CmdRunner found here https://www.plasticscm.com/documentation/cmdrunner/plastic-scm-version-control-cmdrunner-guide. So if it's not possible to have the branch on the external tool command line, I still have the possibility to do it from the command line, but I don't know witch command to use. 'find' ?

 

2- On the jenkins plugins, is there a way to specify a changeset to update the build's workspace to?

I have a Jenkins server with the Plastic plugin (version 2.20) and when I trigger a build I use some variables to update the selector with the right values.

The current selector looks like this :

repository "%REPOSITORY%"
  path "/"
    smartbranch "%BRANCH%"

Where REPOSITORY and BRANCH are the variable used. But I don't see any information to update to a selected changeset. Is this even possible? I know it can be done in command line, but it will be easier to do it directly with the plugin.

 

Do not hesitate to tell me if you want more information.

Share this post


Link to post
Share on other sites

Hi,

1. If I properly understand you you to know the branch name based on the changeset id?

cm find changeset where id=4619075 --format={branch} --nototal

2. You can also use a changeset instead of a branch name:

eg:

repository "%REPOSITORY%"
  path "/"
    smartbranch "%BRANCH%" changeset "%CHANGESET_ID%"

Regards,

Carlos.

Share this post


Link to post
Share on other sites

Thanks for your quick answer. 

1. Perfect, it's what I was looking for. I tried to search the branch and filter on the changeset id, not getting the branch directly from the changeset...

2. I didn't know that the changeset can be set on the selector, I didn't find any documentation on it. How does it react if I don't specify any changeset, if the variable CHANGESET_ID is empty? Does it take the branch's head?

Share this post


Link to post
Share on other sites

Hi,

2. If the specific changeset id is not set, the workspace should be pointing to the head of the %BRACH%.

Regards,

Carlos.

Share this post


Link to post
Share on other sites

Thanks,  I will try this as soon as possible. The solution for the first issue work great !

 

Edit : The selector works fine too ! Thank you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...