public async Task <ActionResult> Continue(int id, int testprojectId) { var entity = await _sessionRepo.FindAsync(id); if (entity == null || entity.Project.Id != testprojectId) { return(HttpNotFound()); } //set queues incomplete to restart foreach (var queue in entity.Queues.Where(z => z.Completed != null).ToList()) { //set failed runs incomplete to restart var pendingRuns = queue.Runs.Where(z => z.Started == null).ToList(); if (pendingRuns.Count > 0) { queue.Completed = null; } } await _uow.CommitAsync(); return(RespondTo(formats => { formats.Default = RedirectToAction("Show", new { id, testprojectId }); formats["text"] = () => Content("Started"); })); }
public async Task <ActionResult> Create(TestProject model) { if (!_pullers.Any(z => z.CanPull(model.RepoPathOrUrl))) { ModelState.AddModelError("RepoPathOrUrl", "no puller can pull this"); } if (ModelState.IsValid) { _projRepo.Add(model); await _uow.CommitAsync(); return(RedirectToAction("Show", new { id = model.Id })); } SetNav(model); SetViewData(); return(View("new", model)); }
public async Task HandleAsync(T message) { var job = message; Uow.MarkUnchanged(job); Debug.WriteLine("Started job-{0} {2} on agent {1}", job.Id, job.Agent, typeof(T).BaseType.Name); job.Started = DateTime.Now; await Uow.CommitAsync(); await Run(job); job.Completed = DateTime.Now; await Uow.CommitAsync(); Debug.WriteLine("Completed job-{0} {2} on agent {1}", job.Id, job.Agent, typeof(T).BaseType.Name); }
public async Task <ActionResult> Create(int testprojectId, TestPlan model, int[] testcases) { var project = model.Project = await _projRepo.FindAsync(testprojectId); if (testcases == null) { ModelState.AddModelError("testcases", "no tests picked for this plan"); } else { model.SetCases(project.Cases.Where(z => testcases.Contains(z.Id))); } if (ModelState.IsValid) { project.Plans.Add(model); await _uow.CommitAsync(); return(RedirectToAction("Show", new { id = model.Id, testprojectId })); } SetNav(model); return(View("new", model)); }
public async Task <ActionResult> Create(int testprojectId, TestBuild model, int?testagent) { model.Project = await _projRepo.FindAsync(testprojectId); if (testagent.HasValue) { model.Agent = await _agentRepo.FindAsync(testagent); } if (ModelState.IsValid) { _buildRepo.Add(model); await _uow.CommitAsync(); return(RedirectToAction("Index", new { testprojectId })); } SetNav(model); SetViewData(); return(View("new", model)); }