Jenkins setup:-
Plugin development Environment
version 1.25 archetype
I want to try develop a test tracking post-action plugin,and the form “f:select” is bind to user’s accessible project id,which I want to fetch from remote uri in plugin inside.
Since @DataBoundConstructor will inject the pre-configured paramters to the class which extends hudson.tasks.Recorder
, But I’m not sure how to get these saved parameters in the DescriptorImpl
class which extends BuildStepDescriptor<Publisher>
@Extension
public static final class DescriptorImpl extends BuildStepDescriptor<Publisher> {
public DescriptorImpl() {
load();
// load the config,then how to get paramters?
}
public String getCurrentUser() {
Optional<User> currentUser = Optional.ofNullable(User.current());
if (currentUser.isPresent()) {
return currentUser.get().getId();
} else {
return "anonymous";
}
}
@Override
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
}
public ListBoxModel doFillTestProjectItems() {
ListBoxModel items = new ListBoxModel();
items.add("I WANT TO ADD THE PRE-CONFIGURED DATA")
return items;
}
// ...
}
Any suggestions?