Ejemplo n.º 1
0
    public BuildRequest getInstallRequest(string machine)
    {
        DefectBuild  b = DefectBuild.GetTask2Build(machine, DefectBuild.BuildType.releasebuild);
        BuildRequest r = new BuildRequest();

        if (b != null)
        {
            DefectBase def  = new DefectBase(Defect.GetTTbyID(b.DEFID));
            DefectUser user = new DefectUser(int.Parse(def.AUSER));
            r.ID   = b.ID;
            r.TTID = def.ID;
            r.COMM = b.NOTES;
            string em = user.EMAIL.Trim();
            if (string.IsNullOrEmpty(em))
            {
                r.USER = "******";
            }
            else
            {
                r.USER = em.Substring(0, em.IndexOf("@")).ToUpper();
            }
            r.SUMMARY = def.SUMMARY;
            r.BRANCH  = def.BRANCH;
        }
        return(r);
    }
Ejemplo n.º 2
0
 public void cancelBuildByTask(string ttid)
 {
     if (string.IsNullOrEmpty(ttid))
     {
         return;
     }
     DefectBuild.CancelRequestByTask(Convert.ToInt32(ttid));
 }
Ejemplo n.º 3
0
 public void addBuildByTask(string ttid, string notes, string btype)
 {
     if (string.IsNullOrEmpty(ttid))
     {
         return;
     }
     DefectBuild.AddRequestByTask(Convert.ToInt32(ttid), "Public Release", DefectBuild.BuildType.releasebuild);
 }
Ejemplo n.º 4
0
 public List <DefectBuild> getBuildsByTask(int from, int to, string ttid)
 {
     CurrentContext.Validate();
     if (string.IsNullOrEmpty(ttid))
     {
         return(new List <DefectBuild>());
     }
     return(DefectBuild.EnumData(from, to, int.Parse(ttid)));
 }
Ejemplo n.º 5
0
    public void CommentBuild(int id, string comment)
    {
        DefectBuild b = new DefectBuild(id)
        {
            STATUSTXT = comment
        };

        b.Store();
    }
Ejemplo n.º 6
0
    public void FailBuild(int id)
    {
        DefectBuild b = new DefectBuild(id)
        {
            STATUS = DefectBuild.BuildStatus.failed.ToString()
        };

        b.Store();
        if (Settings.CurrentSettings.RELEASETTID == b.TTID.ToString())
        {
            VersionBuilder.SendAlarm("❌Failed to build version. Please check the logs!!!");
        }
    }
Ejemplo n.º 7
0
    public static bool hasBuildRequest()
    {
        DefectBuild worker = new DefectBuild();

        foreach (DataRow r in worker.GetRecords($"WHERE {_stat} = {(int)BuildStatus.progress} and DATEDIFF(MINUTE, {_dateUp}, GETDATE()) > {Settings.CurrentSettings.BUILDTIMEOUT}"))
        {
            DefectBuild d = new DefectBuild();
            d.Load(r);
            d.STATUSTXT = "Time out - cancelled!";
            d.SetBuildStatus(BuildStatus.cancelled);
            d.Store();
        }
        return(Convert.ToInt32(GetValue(string.Format("SELECT COUNT(*) FROM {0} WHERE {1} IS NULL OR {1} = {2}", _Tabl, _stat, (int)BuildStatus.progress))) > 0);
    }
Ejemplo n.º 8
0
 public List <DefectBuild> getBuildRequests(int from, int to)
 {
     CurrentContext.Validate();
     return(DefectBuild.EnumData(from, to));
 }
Ejemplo n.º 9
0
    public bool IsBuildCancelled(int id)
    {
        DefectBuild b = new DefectBuild(id);

        return(b.CANCELLED);
    }
Ejemplo n.º 10
0
    public void FinishBuild(int id, string requestguid)
    {
        try
        {
            DefectBuild b = new DefectBuild(id)
            {
                STATUS = DefectBuild.BuildStatus.finishedok.ToString(), TESTGUID = requestguid
            };
            b.Store();

            if (Settings.CurrentSettings.RELEASETTID == b.TTID.ToString() && b.TYPE == (int)DefectBuild.BuildType.releasebuild)
            {
                //release builder sends its own notifications
                return;
            }

            Defect     d = new Defect(b.TTID);
            DefectUser u = new DefectUser(b.TTUSERID);
            d.SetUpdater(new MPSUser(u.TRID));
            List <DefectDispo> dsps = DefectDispo.EnumTestsStarted();
            if (dsps.Count > 0)
            {
                string   currentlock = Guid.NewGuid().ToString();
                LockInfo li          = Defect.Locktask(b.TTID.ToString(), currentlock, u.TRID.ToString(), true);
                d.DISPO = dsps[0].ID.ToString();
                if (d.PRIMARYHOURS == null)
                {
                    d.PRIMARYHOURS = d.SPENT;
                }
                d.Store();
                DefectEvent.AddEventByTask(id, DefectEvent.Eventtype.QualityAssurance, b.TTUSERID, "Sent for QA Automation");
                Defect.UnLocktask(u.TRID.ToString(), currentlock);
            }

            if (Settings.CurrentSettings.RELEASETTID == b.TTID.ToString())
            {
                VersionBuilder.SendAlarm("✅New internal release build has been finished. Testing is starting...");
            }
            else
            {
                try
                {
                    string mess = $"New task from {u.FULLNAME} is ready for tests!{Settings.CurrentSettings.GetTTAnchor(b.TTID, d.FIRE ? "taskfire.png" : "")}";
                    TestChannel.SendMessage(mess);
                }
                catch (Exception e)
                {
                    Logger.Log(e);
                }
            }

            string bst_b = d.BSTBATCHES.Trim();
            string bst_c = d.BSTCOMMANDS.Trim();
            if (!string.IsNullOrEmpty(bst_b) || !string.IsNullOrEmpty(bst_c))
            {
                string batches  = string.Join(",", bst_b.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries));
                string commands = string.Join(",", bst_c.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries));
                using (var wcClient = new WebClient())
                {
                    var reqparm = new NameValueCollection();
                    reqparm.Add("guid", requestguid);
                    reqparm.Add("commaseparatedbatches", batches);
                    reqparm.Add("commaseparatedcommands", commands);
                    reqparm.Add("priority", d.TESTPRIORITY);
                    //reqparm.Add("branch", d.BRANCHBST);
                    wcClient.UploadValues(Settings.CurrentSettings.BSTSITESERVICE + "/StartTest", reqparm);
                }
            }
        }
        catch (Exception e)
        {
            Logger.Log(e);
        }
    }
Ejemplo n.º 11
0
 public bool hasBuildRequest()
 {
     return(DefectBuild.hasBuildRequest());
 }