Hi All,

i'm trying to override pipeline parameters using groovy code or declarative 
code.

i can't wrap this thing to work and i hope someone can help me figure out 
why.

while working with the declarative pipelines i have used the following code:

properties([
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: 
'', daysToKeepStr: '', numToKeepStr: '25')),
parameters([
string(defaultValue: 'someValue', description: '', name: 'someName'),
])
,pipelineTriggers([cron('H(0-0) 00 * * 1,2,5,6')])
])


the result is that every time i change some parameter default value it will 
take place only after running it twice (first run after change does not 
take the new value)

so i found this groovy way:

def npl = new ArrayList<StringParameterValue>()
for(param in propsObj.properties.parameters)
{
npl.add(new StringParameterValue(param.string.name, 
param.string.defaultValue,param.string.description))
}

def newPa = null
def oldPa = manager.build.getAction(ParametersAction.class)
if (oldPa != null) {
manager.build.removeAction(oldPa)
}

newPa = new ParametersAction(npl)


manager.build.actions.add(newPa)


*-------- *but this one doesn't work when using it from a global library.

does anyone know a better way to do this?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/59ba360b-1d54-4ab9-b91d-5ff1fb9b4657%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to