Пример #1
0
        private async Task <ScriptManualIntervention> CreateScriptManualIntervention(
            ManualIntervention manualIntervention)
        {
            string target;

            if (manualIntervention.IsGroup)
            {
                var groupData = await this.userRepo.GetGroupAsync(manualIntervention.UserId);

                target = groupData.Name;
            }
            else
            {
                var userData = await this.userRepo.GetUserAsync(manualIntervention.UserId);

                target = userData.Name;
            }

            return(new ScriptManualIntervention
            {
                DisplayName = manualIntervention.DisplayName,
                Sequence = manualIntervention.Sequence,
                Enabled = manualIntervention.Enabled,
                InterventionText = manualIntervention.Text,
                Target = target,
                IsTargetGroup = manualIntervention.IsGroup
            });
        }
        public ManualIntervention RejectManualIntervention()
        {
            string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name;

            // Get a release client instance
            VssConnection     connection    = Context.Connection;
            ReleaseHttpClient releaseClient = connection.GetClient <ReleaseHttpClient>();

            ManualInterventionUpdateMetadata manualInterventionUpdateMetadata = new ManualInterventionUpdateMetadata()
            {
                Status  = ManualInterventionStatus.Rejected,
                Comment = "Reject MI"
            };

            IList <ManualIntervention> manualInterventions = null;

            // Get all manual interventions
            ClientSampleHelpers.Retry(
                TimeSpan.FromMinutes(2),
                TimeSpan.FromSeconds(5),
                () =>
            {
                manualInterventions = releaseClient.GetManualInterventionsAsync(project: projectName, releaseId: this._newlyCreatedRelease2.Id).Result;
                return(manualInterventions.Count > 0);
            });

            // Update a manual intervention
            ManualIntervention manualIntervention = releaseClient.UpdateManualInterventionAsync(manualInterventionUpdateMetadata: manualInterventionUpdateMetadata, project: projectName, releaseId: this._newlyCreatedRelease2.Id, manualInterventionId: manualInterventions.FirstOrDefault().Id).Result;

            Context.Log("{0} {1}", manualIntervention.Id.ToString().PadLeft(6), manualIntervention.Name);

            return(manualIntervention);
        }
        public ManualIntervention GetManualIntervention()
        {
            string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name;

            // Get a release client instance
            VssConnection     connection    = Context.Connection;
            ReleaseHttpClient releaseClient = connection.GetClient <ReleaseHttpClient>();

            // Get a manual intervention
            ManualIntervention manualIntervention = releaseClient.GetManualInterventionAsync(project: projectName, releaseId: this._newlyCreatedRelease1.Id, manualInterventionId: this._manualInterventions.FirstOrDefault().Id).Result;

            Context.Log("{0} {1}", manualIntervention.Id.ToString().PadLeft(6), manualIntervention.Name);

            return(manualIntervention);
        }
Пример #4
0
        private static ReleaseAction ParseManualIntervention(XElement node)
        {
            var idElement = node.Attribute("Recipient").Value;
            var splitId   = idElement.Split(':');

            var parsedManualIntervention = new ManualIntervention
            {
                DisplayName             = node.Attribute("DisplayName").Value,
                DisplayNameIsMeaningful = true,
                ItemType = BlockType.ManualIntervention,
                Text     = node.Attribute("Details").Value,
                IsGroup  = int.Parse(splitId[0]) == 2,
                UserId   = int.Parse(splitId[1])
            };

            FireActionParsedEvent(parsedManualIntervention);
            return(parsedManualIntervention);
        }
        public ManualIntervention ResumeManualIntervention()
        {
            string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name;

            // Get a release client instance
            VssConnection     connection    = Context.Connection;
            ReleaseHttpClient releaseClient = connection.GetClient <ReleaseHttpClient>();

            ManualInterventionUpdateMetadata manualInterventionUpdateMetadata = new ManualInterventionUpdateMetadata()
            {
                Status  = ManualInterventionStatus.Approved,
                Comment = "Good to resume"
            };

            // Update a manual intervention
            ManualIntervention manualIntervention = releaseClient.UpdateManualInterventionAsync(manualInterventionUpdateMetadata: manualInterventionUpdateMetadata, project: projectName, releaseId: this._newlyCreatedRelease1.Id, manualInterventionId: this._manualInterventions.FirstOrDefault().Id).Result;

            Context.Log("{0} {1}", manualIntervention.Id.ToString().PadLeft(6), manualIntervention.Name);

            return(manualIntervention);
        }