Exemplo n.º 1
0
        public static RuleAppData Add(string ruleAppXml)
        {
            XmlDocument d = new XmlDocument();

            d.LoadXml(ruleAppXml);
            XmlNode defTag          = d.GetElementsByTagName("RuleApplicationDef")[0];
            string  ruleAppGuid     = defTag.Attributes["Guid"].Value;
            string  ruleAppName     = defTag.Attributes["Name"].Value;
            string  ruleAppRevision = defTag.Attributes["Revision"].Value;

            RuleAppData appData;

            lock (_ruleAppsLock)
            {
                appData = _ruleApps.FirstOrDefault(a => a.Name == ruleAppName);
                if (appData == null)
                {
                    appData = new RuleAppData();
                    _ruleApps.Add(appData);
                }

                appData.GUID        = ruleAppGuid;
                appData.Name        = ruleAppName;
                appData.Revision    = ruleAppRevision;
                appData.LastUpdated = DateTime.UtcNow;

                foreach (var oldRuleApp in _ruleApps.Where(a => a.LastUpdated < DateTime.UtcNow.AddMinutes(-5)).ToList())
                {
                    _ruleApps.Remove(oldRuleApp);
                }
            }

            return(appData);
        }
Exemplo n.º 2
0
        private void TriggerPipeline(RuleAppData ruleApp)
        {
            // If desired, include properties from ruleApp in the pipeline trigger request.
            string org        = ConfigurationManager.AppSettings["AzureDevOpsPipelineOrg"];
            string project    = ConfigurationManager.AppSettings["AzureDevOpsPipelineProject"];
            string pipelineId = ConfigurationManager.AppSettings["AzureDevOpsPipelineID"];
            string authToken  = ConfigurationManager.AppSettings["AzureDevOpsAuthToken"];

            AzureDevOpsApiHelper.QueuePipelineBuild(org, project, pipelineId, authToken);
        }