/// <summary> /// Provides a Web Client for Jenkins REST API. /// </summary> /// <returns>A <see cref="IJenkinsRestClient"/> instance.</returns> public IJenkinsRestClient GetClient() { try { this.restClientLock.EnterUpgradeableReadLock(); if (this.restClient == null) { try { this.restClientLock.EnterWriteLock(); this.webClient = new JenkinsWebClient(); this.restManager = new RestManager(this.webClient, this.userName, this.apiToken); this.restClient = new JenkinsRestClient(this.restManager); } finally { this.restClientLock.ExitWriteLock(); } } return(this.restClient); } finally { this.restClientLock.ExitUpgradeableReadLock(); } }
/// <summary> /// Load up the access. NOTE: your api key should be in the windows credential store for this server!!! /// Initialize Jenkin's library access for everything. /// </summary> /// <remarks> /// To put the username and password in, open the "Credential Manager" control panel. /// Then for window's credentials, under "Generic credentials" make an entry with: /// Internet or network address: jenks-higgs.phys.washington.edu:8080 /// Username: your username /// Password: the api key from the jenkins server. /// </remarks> public TDTJobAccess() { var factory = new JenkinsRestFactory(); var cred = WebGenericCredentialsLib.CredAccess.LookupUserPass("jenks-higgs.phys.washington.edu:8080"); if (cred != null) { _webClient = new BasicAuthJenkinsClient(cred.Item1, cred.Item2); factory.SetRestClient(_webClient); } _client = factory.GetClient(); }
public StopBuildCommand(IJenkinsRestClient jenkinsRestClient, string stopBuildUrl) { this.jenkinsRestClient = jenkinsRestClient; this.stopBuildUrl = stopBuildUrl; }
public JenkinsService(IJenkinsRestClient jenkinsClient, string serverUrl, IList <JenkinsViewModel> jenkinsViewModels) { this.jenkinsClient = jenkinsClient; this.serverUrl = serverUrl; this.jenkinsViewModels = jenkinsViewModels; }
public RunBuildCommand(IJenkinsRestClient jenkinsRestClient, string buildUrl) { this.jenkinsRestClient = jenkinsRestClient; this.buildUrl = buildUrl; }