Esempio n. 1
0
        public static void Fail(string error)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Echo();
            Echo(true, error, true);
            Echo();
            Console.ForegroundColor = oColor;

            if (buildId != (int?)null)
            {
                try
                {
                    //using (BT_SemiAutoEntities de = new BT_SemiAutoEntities())
                    //{
                    //    Build cb = de.Builds.Single(b => b.Id == currentBuild.Id);
                    //    cb.Status = "Failed";
                    //    de.SaveChanges();
                    //}

                    Echo("Marking build as Failed.", false);

                    using (BuildWellWCF.BuildWellWCFClient client = new BuildWellWCF.BuildWellWCFClient())
                    {
                        client.UpdateBuildStatus((int)buildId, "Failed");
                    }
                }
                catch
                {
                }
            }

            Environment.Exit(9);
        }
Esempio n. 2
0
        private static void AddReferencesToDatabase()
        {
            //bool inDb = false;
            //try
            //{
            //    using (BT_SemiAutoEntities de = new BT_SemiAutoEntities())
            //    {
            //        de.Builds.Add(currentBuild);
            //        de.SaveChanges();
            //        inDb = true;
            //    }
            //}
            //catch
            //{
            //    inDb = false;
            //}

            //if (inDb == true)
            //{
            Console.ForegroundColor = infoColor;
            Echo("Adding references for this build to the database...");
            Echo();
            //}

            foreach (string r in gatheredRefs.Keys)
            {
                string rev = GetRevision(r);
                string url = PathConverter.ConvertPathToUrl(r, baseUrl, workspace);
                //BuildSource bs = new BuildSource();
                //bs.BuildId = currentBuild.Id;
                //bs.RepositoryType = "svn";
                //bs.Revision = rev;
                //bs.Url = url;
                //bs.ReferencedBy = gatheredRefs[r];

                using (BuildWellWCF.BuildWellWCFClient client = new BuildWellWCF.BuildWellWCFClient())
                {
                    client.AddBuildReference((int)buildId, gatheredRefs[r], "svn", rev, url);
                }

                //bi.SourceCodeRevision += bs.Revision + " " + bs.Url + " Reference By: " + bs.ReferencedBy + "\n\r";

                //if (inDb == true)
                //{
                //    using (BT_SemiAutoEntities de = new BT_SemiAutoEntities())
                //    {
                //        de.BuildSources.Add(bs);
                //        de.SaveChanges();
                //    }
                //}
            }

            Echo();
            Console.ForegroundColor = oColor;
        }
Esempio n. 3
0
        private static void InitializeBuild(string cr)
        {
            Console.WriteLine("Creating the build object...");
            //currentBuild = new Build();
            //currentBuild.BuildDate = DateTime.Now;
            //currentBuild.ChangeControl = cr;
            //currentBuild.Status = "In Progress";
            //currentBuild.BuildLog = "";

            using (BuildWellWCF.BuildWellWCFClient client = new BuildWellWCF.BuildWellWCFClient())
            {
                buildId = client.SaveBuild(null, null, cr, "In Progress");
            }

            //bi = new BuildInfo.BuildInfo();
            //bi.Brand = "SemiAuto Build";
            //bi.Version = currentBuild.ChangeControl;

            try
            {
                //BT_SemiAutoEntities de = new BT_SemiAutoEntities();
                //de = new BT_SemiAutoEntities();
                //using (de = new BT_SemiAutoEntities())
                //{
                //    de.Builds.Add(currentBuild);
                //    de.SaveChanges();
                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine("Aaaaaaaaaahhhhhhhhh!");
                Console.Write(ex.Message);
                //Console.WriteLine("Trying again...");
                //InitializeBuild(cr);
            }
        }
Esempio n. 4
0
        private static void Echo(bool asIs, string msg = "", bool saveToLog = false)
        {
            //Echo to console
            ConsoleWrite(msg, asIs);

            if (saveToLog == true)
            {
                //save to log
                if (buildId != (int?)null)
                {
                    //using (BT_SemiAutoEntities de = new BT_SemiAutoEntities())
                    //{
                    //    Build cb = de.Builds.Single(b => b.Id == currentBuild.Id);
                    //    de.AppendToBuildLog(buildId, "\n" + msg);
                    //    de.SaveChanges();
                    //}

                    using (BuildWellWCF.BuildWellWCFClient client = new BuildWellWCF.BuildWellWCFClient())
                    {
                        client.AppendToBuildLog((int)buildId, "\n" + msg);
                    }
                }
            }
        }
Esempio n. 5
0
        private static void Success(string rev)
        {
            try
            {
                //using (BT_SemiAutoEntities de = new BT_SemiAutoEntities())
                //{
                //    Build cb = de.Builds.Single(b => b.Id == currentBuild.Id);
                //    cb.Status = "Success";
                //    cb.BinaryRevision = rev;
                //    de.SaveChanges();
                //}

                Echo("Marking build as Success.  Rev - " + rev, false);

                using (BuildWellWCF.BuildWellWCFClient client = new BuildWellWCF.BuildWellWCFClient())
                {
                    client.UpdateBuildStatus((int)buildId, "Success");
                    client.UpdateBuildBinaryRevision((int)buildId, rev);
                }
            }
            catch
            {
            }
        }