-
-
Save lanwen/553b51c9d2227eaad435 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Extension | |
public class TrekClientDescriptor extends GlobalConfiguration implements Module { | |
private TrackerClientConfig config = TrackerClientConfig.empty(); | |
public TrekClientDescriptor() { | |
load(); | |
} | |
@Override | |
public void configure(Binder binder) { | |
binder.bind(TrackerClient.class).to(TrekClientImpl.class); | |
} | |
@Provides | |
public TrekClientImpl getClient() { | |
return new TrekClientImpl(String.valueOf(config.getApiUrl()), tokenFrom(config.getCredentialsId())); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IssueUpdater extends Recorder { | |
@DataBoundConstructor | |
public IssueUpdater() { | |
} | |
@Inject | |
private TrackerClient client; | |
@Override | |
public boolean perform(final AbstractBuild build, final Launcher launcher, final BuildListener listener) { | |
// at this moment - client = null; | |
// If i do Jenkins.getInstance().getInjector().injectMembers(this); - all ok | |
// ... | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TrekClientImpl implements TrackerClient { | |
@Inject | |
public TrekClientImpl(String apiUrl, String apiToken) { | |
// some logic with url and token | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment