private void buttonRunBuildClick(object sender, EventArgs e)
 {
     runOnSelectedNode(delegate(BambooBuild b) {
         string key = BambooBuildUtils.getPlanKey(b);
         status.setInfo("Adding build " + key + " to the build queue...");
         Thread t = PlvsUtils.createThread(() => runBuildWorker(b, key));
         t.Start();
     });
 }
        private BambooBuild.PlanState getPlanStateForBuild(string buildKey)
        {
            BambooBuild.PlanState state;

            string endpoint = server.Url + string.Format(PLAN_DETAILS, BambooBuildUtils.getPlanKey(buildKey));

            using (Stream stream = getQueryResultStream(endpoint + getBasicAuthParameter(endpoint), true)) {
                XPathDocument doc = XPathUtils.getXmlDocument(stream);

                string code = getRestErrorStatusCode(doc);
                if (code != null)
                {
                    throw new Exception(code);
                }

                XPathNavigator nav = doc.CreateNavigator();

                XPathExpression   expr       = nav.Compile("/plan/isInBuildQueue");
                XPathNodeIterator it         = nav.Select(expr);
                string            inQueue    = "false";
                string            isBuilding = "false";
                if (it.Count > 0)
                {
                    it.MoveNext();
                    inQueue = it.Current.Value;
                }
                expr = nav.Compile("/plan/isBuilding");
                it   = nav.Select(expr);
                if (it.Count > 0)
                {
                    it.MoveNext();
                    isBuilding = it.Current.Value;
                }
                if (inQueue.Equals("true"))
                {
                    state = BambooBuild.PlanState.IN_QUEUE;
                }
                else if (isBuilding.Equals("true"))
                {
                    state = BambooBuild.PlanState.BUILDING;
                }
                else
                {
                    state = BambooBuild.PlanState.IDLE;
                }
            }
            return(state);
        }
Exemplo n.º 3
0
 private void getHistoryWorker(BambooBuild build, int myGeneration)
 {
     try {
         ICollection <BambooBuild> builds =
             BambooServerFacade.Instance.getLastNBuildsForPlan(build.Server, BambooBuildUtils.getPlanKey(build), MAX_HISTORY);
         this.safeInvoke(new MethodInvoker(delegate {
             if (myGeneration != generation)
             {
                 return;
             }
             fillHistory(builds);
         }));
     } catch (Exception e) {
         statusLabel.setError("Unable to retrieve build history", e);
     }
 }
Exemplo n.º 4
0
        private void buttonViewInBrowser_Click(object sender, EventArgs e)
        {
            BambooBuild b = getSelectedBuild();

            if (b == null)
            {
                return;
            }
            try {
                PlvsUtils.runBrowser(b.Server.Url + "/build/viewBuildResults.action?buildKey="
                                     + BambooBuildUtils.getPlanKey(b) + "&buildNumber=" + b.Number);
            } catch (Exception ex) {
                Debug.WriteLine("buttonViewInBrowser_Click - exception: " + ex.Message);
            }
            UsageCollector.Instance.bumpBambooBuildsOpen();
        }
 private static string getMapPlanKeyFromBuild(BambooBuild build)
 {
     return(build.Server.GUID + BambooBuildUtils.getPlanKey(build));
 }