The problem with the set build name plugin is that it is a build wrapper 
and the promotion plugin does not support those and if it did it would 
apply to the promotion job itself. As a promotion job is a job of its own 
with a slimed down configuration.

If you have the groovy plugin installed and available you can modify the 
parent build name via the following system groovy script from the promotion 
step.
(Note you need to be admin to configure this for a job, Add a System Groovy 
script step and set this as the Groovy command )

The first few lines get the build that the promotion was for.

The last line sets the string for the build name in this example I just 
append the original build number to the string "test_promote_"


import hudson.model.*
//gets current promotion build env variables
def thisbuild = Thread.currentThread().executable  
def envVars= thisbuild.properties.get("envVars"); 

//gets the parent job that we are promoting
def job = Hudson.instance.getItem(envVars["PROMOTED_JOB_NAME"]);

//gets the build that we are promoting 
//need to convert env string to Int first
def buildid = Integer.parseInt(envVars["PROMOTED_NUMBER"],10)
def build = job.getBuildByNumber(buildid)

//finally we can set the buildname
build.setDisplayName("test_promote_"+envVars["PROMOTED_NUMBER"])


I'm sure there are other (probably better) ways of doing this 

Chris,

On Tuesday, June 19, 2012 2:19:40 PM UTC+1, Talal Rabaa wrote:
>
> Hello! 
>
> I have the set build name and promote plugins installed.  However, it 
> seems I don't have the action option to set the build name in promote.  Can 
> anybody recommend other strategies I could use to set it?  I'd like it to 
> only be set when a promote has occurred. 
>
> Cheers! 
>
>    Anthony

Reply via email to