To answer my own question, the issue was that I was trying to access the
Workflow job before Jenkins had properly loaded the extension.
The following change allowed me to create a Workflow job dynamically
*@Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED)*
public void initProject() {
try {
for (final WorkflowJob job :
Util.createSubList(jenkins().getItemMap().values(), WorkflowJob.class)) {
if (job.getDisplayName().equalsIgnoreCase(projectName())) {
workflowJob = job;
}
}
if (workflowJob == null) {
workflowJob = jenkins().createProject(WorkflowJob.class,
ReleaseManagementPlugin.class.getSimpleName());
}
} catch (final Exception ex) {
throw ReleaseException.builder().with(ex).build();
}
}
On Monday, August 28, 2017 at 2:11:08 PM UTC-5, Shaun Thompson wrote:
>
>
> From the command line it works. It looks like I'll have to dig into the
> extensions bit and see how this is getting setup.
>
> On Friday, August 25, 2017 at 2:23:38 PM UTC-5, Jesse Glick wrote:
>>
>> On Fri, Aug 25, 2017 at 12:52 PM, Shaun Thompson <[email protected]>
>> wrote:
>> > What's seems odd to me is that the tests supplied with the workflow
>> plugin
>> > show the same issue when I run it locally.
>> >
>> > Any idea on what's going on?
>>
>> Something is seriously wrong in your test environment. Close your IDE,
>> open a command shell, and try
>>
>> mvn clean test
>>
>> Or, for paranoid Linux users,
>>
>> alias dockermvn='docker run -v ~/.m2:/var/maven/.m2 -ti --rm --name
>> mvn -u $(id -u):$(id -g) -e MAVEN_CONFIG=/var/maven/.m2 -v
>> "$PWD":/usr/src/mymaven -w /usr/src/mymaven maven:3.5.0-jdk-8 mvn
>> -Duser.home=/var/maven'
>> dockermvn clean test
>>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" 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-dev/00b3650b-b250-442b-90d2-44b70438e01b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.