Example #1
0
        // GET: /Builds/msvc/{buildrevisionid}
        public ActionResult BuildStatus(string buildrevisionid)
        {
            // Build the build step list model
            BuildStepList list = new BuildStepList ();

            MonkeyWrench.Public.Public ws2 = new MvcWrench.MonkeyWrench.Public.Public ();
            var steps = ws2.GetCompletedSteps (long.Parse (buildrevisionid));

            foreach (CompletedBuildStep step in steps) {
                BuildStepListItem item = new BuildStepListItem (step.Id, TimeSpan.Zero, step.ExitCode, step.CompletionStatus, step.StepName);
                item.LogUrl = string.Format ("~/builds/msvc/{0}/{1}", buildrevisionid, step.Id);

                list.Items.Add (item);
            }

            //// Build the bread crumb bar model
            //BreadCrumb bc = new BreadCrumb ();

            //bc.Crumbs.Add (new Crumb ("Projects", UrlBuilder.Builds));
            //bc.Crumbs.Add (new Crumb (p.Name, UrlBuilder.ProductBuild (p)));
            //bc.Crumbs.Add (new Crumb (string.Format ("Revision {0}", pr.Revision), UrlBuilder.RevisionDetails (pr)));
            //bc.Crumbs.Add (new Crumb (plat.Name));

            //ViewData["Platform"] = platform;
            //ViewData["BreadCrumb"] = bc;
            ViewData["BuildStepList"] = list;
            //ViewData["Installer"] = installer;
            ViewData["PageTitle"] = "MonkeyWrench - Msvc Build Overview";

            return View ("BuildStatus");
        }
Example #2
0
        public ActionResult RevisionDetails(string project, string platform, string revision)
        {
            int lane_id;
            int host_id;
            int revision_id;

            if (!FindHostAndLane (project, platform, out host_id, out lane_id))
                return View ("Error");

            WebServices ws = new WebServices ();
            WebServiceLogin login = new WebServiceLogin ();

            var rev = ws.FindRevisionForLane (login, null, revision, lane_id, null);
            revision_id = rev.Revision.id;

            GetViewLaneDataResponse data = ws.GetViewLaneData (login, lane_id, null, host_id, null, revision_id, null);

            Commit commit = new Commit ();

            commit.CompletionStatus = data.RevisionWork.state;
            commit.Revision = data.Revision.revision;
            commit.Author = data.Revision.author;
            commit.CommitTime = data.Revision.date;
            commit.Lane = data.Lane.lane;
            commit.Host = data.Host.host;
            commit.Builder = data.WorkHost == null ? "" : data.WorkHost.host;
            commit.BuildDuration = TimeSpan.Zero;
            commit.CommitLog = "";
            commit.Email = SvnGravatars.Get (commit.Author);
            commit.ProjectLinkName = project;

            // Download the commit log to add
            string url = string.Format ("http://build.mono-project.com/GetRevisionLog.aspx?id={0}", data.Revision.id);

            WebClient wc = new WebClient ();
            string content = wc.DownloadString (url);

            Regex reg = new Regex (@"\<pre\ id\=\""ctl00_content_log\""\>(?<data>(?:.|\n)*?)\<\/pre\>", RegexOptions.Multiline);
            Match m = reg.Match (content);
            commit.CommitLog = m.Groups["data"].Value.Trim ();

            // Build the list of steps
            BuildStepList bsl = new BuildStepList ();

            string history_url = @"http://build.mono-project.com/ViewWorkTable.aspx?lane_id={0}&host_id={1}&command_id={2}";
            string log_url = @"http://build.mono-project.com/GetFile.aspx?id={0}";

            DateTime start_time = DateTime.MinValue;

            for (int j = 0; j < data.WorkViews.Length; j++) {
                var item = data.WorkViews[j];
                var log = data.WorkFileViews[j];

                if (j == 0)
                    start_time = item.starttime;

                BuildStepListItem i = new BuildStepListItem ();

                i.BuildStepID = item.id;
                i.ElapsedTime = item.endtime.Subtract (item.starttime);
                i.HistoryUrl = string.Format (history_url, lane_id, host_id, item.command_id);
                i.Name = item.command;
                i.Results = item.summary;
                i.CompletionStatus = item.state;

                if (log != null && log.Length > 0)
                    i.LogUrl = string.Format (log_url, log[0].id);

                bsl.Items.Add (i);
            }

            if (data.RevisionWork.completed)
                commit.BuildDuration = data.RevisionWork.endtime.Subtract (start_time);

            //ws.getre
            ViewData["commit"] = commit;
            ViewData["steps"] = bsl;
            ViewData["PageTitle"] = string.Format ("MonkeyWrench - Revision {0} - Host {1}", commit.Revision, commit.Host);

            return View ("RevisionDetails");
        }