well ... it seems sort of nasty, but I got to it like this ...
Map<JobPropertyDescriptor,JobProperty> jobProperties =
project.getProperties();
Set<JobPropertyDescriptor> set = jobProperties.keySet();
for (JobPropertyDescriptor descriptor: set) {
if (descriptor.getDisplayName().equals("Parameters")) {
JobProperty property = jobProperties.get(descriptor);
ParametersDefinitionProperty paramDefs =
property.getJobActions(project).iterator().next();
StringParameterDefinition stringParamDef =
paramDefs.getParameterDefinition("SCM_URL");
println("SCM_URL: " + stringParamDef.getDefaultValue());
}
}
On Thu, Dec 26, 2013 at 10:51 AM, Steve Maring <[email protected]>wrote:
> ok ... my bad ... I had deleted all the builds that really did have that
> string param in them
>
> is there a way to pull that param from the project config and not rely on
> any previous builds having used it?
>
>
> On Thu, Dec 26, 2013 at 8:16 AM, Steve Maring <[email protected]>wrote:
>
>> I have some build flow dsl (groovy) that looks like this ...
>>
>> FreeStyleProject project = (FreeStyleProject)
>> Jenkins.instance.getItemByFullName("my-jenkins-job");
>> String scmType = project.getScm().getType();
>> println("scmType: " + scmType);
>>
>> VariableResolver resolver =
>> project.getLastBuild().getBuildVariableResolver();
>> println("SCM_URL: " + resolver.resolve("SCM_URL").getClass().getName());
>>
>> the output of this is ...
>>
>> scmType: hudson.scm.SubversionSCM
>> SCM_URL: org.codehaus.groovy.runtime.NullObject
>>
>>
>>
>> I was expecting the class of that to be *hudson.model.StringParameterValue*
>>
>>
>> *I know that the SCM_URL string parameter exists in that job ... what am I
>> doing wrong?*
>>
>>
>>
>> *Thanks,*
>> *Steve Maring*
>>
>> *Orlando, FL*
>>
>>
>
--
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].
For more options, visit https://groups.google.com/groups/opt_out.