public bool Equals(JenkinsJob target) { if (target == null) { return(false); } return(string.Equals(target.Url, this.Url)); }
public async static Task CancelBuild(JenkinsJob job, string jenkinsServerUrl) { if (job == null) { throw new ArgumentNullException("job"); } Uri cancelBuildUri = CreateCancelBuildUri(job); if (cancelBuildUri != null) { using (WebClient client = JenkinsDataLoader.CreateJenkinsWebClient(jenkinsServerUrl)) { byte[] response = await client.UploadValuesTaskAsync(cancelBuildUri, new NameValueCollection()); } } }
private static Uri CreateCancelBuildUri(JenkinsJob job) { var serverUri = new Uri(job.Url); if (job.LatestBuild != null && job.LatestBuild.IsBuilding) { // http://vmsobuild03:8080/job/Bronkhorst.BHTInstruments6%20Development/870/stop return new Uri(serverUri, job.LatestBuild.Number + "/stop"); } return null; }
private async void HandleShowLatestLog(JenkinsJob job) { if (job.LatestBuild == null) { Logger.LogInfo("No build available to show log from."); return; } try { string fileName = await JenkinsJobManager.GetLatestLog(job.Url, SelectedJenkinsServer); if (!string.IsNullOrWhiteSpace(fileName)) { ServicesContainer.VisualStudioFileManager.OpenFile(fileName); } } catch (Exception ex) { Logger.Log(ex); } }
public bool Equals(JenkinsJob target) { if (target == null) { return false; } return string.Equals(target.Url, this.Url); }
private bool CanDoJobAction(JenkinsJob arg) { return SelectedJob != null; }
private void MergeUpdatedJenkinsJob(JenkinsJob refreshed, JenkinsJob original) { original.Builds = refreshed.Builds; original.IsEnabled = refreshed.IsEnabled; original.IsQueued = refreshed.IsQueued; original.Name = refreshed.Name; original.QueueItem = refreshed.QueueItem; }
private async void DequeueBuild(JenkinsJob j) { if (j.QueueItem == null) { return; } try { await JenkinsJobManager.DequeueJob(j.QueueItem, SelectedJenkinsServer.Url); ForceReload(false); } catch (WebException ex) { var resp = ex.Response as HttpWebResponse; if (resp != null) { if (resp.StatusCode == HttpStatusCode.NotFound) { // Known bug (https://issues.jenkins-ci.org/browse/JENKINS-21311), dequeue actually worked but // returns a 404 result. ForceReload(false); return; } Logger.LogInfo(string.Format(Resources.WebExceptionMessage, "Dequeue job", resp.StatusDescription)); } else { Logger.LogInfo(string.Format(Resources.WebExceptionMessage, "Dequeue job", ex.Status)); } Logger.Log(ex); } }
private async void CancelBuild(JenkinsJob j) { try { await JenkinsJobManager.CancelBuild(j, SelectedJenkinsServer.Url); ForceReload(false); } catch (WebException ex) { Logger.Log(ex); var resp = ex.Response as HttpWebResponse; if (resp != null) { Logger.LogInfo(string.Format(Resources.WebExceptionMessage, "Cancel job", resp.StatusDescription)); } else { Logger.LogInfo(string.Format(Resources.WebExceptionMessage, "Cancel job", ex.Status)); } } }
private async void BuildJob(JenkinsJob j) { try { await BuildJob(j.Url, SelectedJenkinsServer.Url); ForceReload(false); } catch (Exception ex) { Logger.Log(ex); } }
private void ShowWebsite(JenkinsJob j) { try { Process.Start(j.Url); } catch (Exception ex) { Logger.Log(ex); } }
private void LinkJobToSolution(JenkinsJob j) { try { string slnPath = ServicesContainer.VisualStudioSolutionInfo.SolutionPath; if (string.IsNullOrEmpty(slnPath)) { Logger.LogInfo(Resources.SolutionNotLoaded); return; } ApiHandlerSettingsManager.SaveJobForSolution( j.Url, slnPath, SelectedView.Name, SelectedJenkinsServer.Url); UpdateJobLinkedStatus(); } catch (Exception ex) { Logger.Log(ex); } }