internal override async Task <int> RunAsync(CancellationToken cancellationToken)
        {
            var context = await Context
                          .WithAzureLogon()
                          .WithDevOpsLogon()
                          .BuildAsync(cancellationToken);

            var  rules = new AggregatorRules(context.Azure, context.Logger);
            bool ok    = DevOpsEvents.IsValidEvent(Event);

            if (!ok)
            {
                context.Logger.WriteError($"Invalid event type.");
                return(ExitCodes.InvalidArguments);
            }
            if (Local)
            {
                ok = await rules.InvokeLocalAsync(Project, Event, WorkItemId, Source, DryRun, SaveMode, ImpersonateExecution, cancellationToken);

                return(ok ? ExitCodes.Success : ExitCodes.Failure);
            }
            else
            {
                var instance = context.Naming.Instance(Instance, ResourceGroup);
                context.Logger.WriteWarning("Untested feature!");
                ok = await rules.InvokeRemoteAsync(Account, Project, Event, WorkItemId, instance, Name, DryRun, SaveMode, ImpersonateExecution, cancellationToken);

                return(ok ? ExitCodes.Success : ExitCodes.Failure);
            }
        }
Exemplo n.º 2
0
        internal override async Task <int> RunAsync()
        {
            var context = await Context
                          .WithAzureLogon()
                          .WithDevOpsLogon()
                          .Build();

            var rules = new AggregatorRules(context.Azure, context.Logger);

            if (Local)
            {
                bool ok = await rules.InvokeLocalAsync(Project, Event, WorkItemId, Source, DryRun, SaveMode);

                return(ok ? 0 : 1);
            }
            else
            {
                var instance = new InstanceName(Instance, ResourceGroup);
                context.Logger.WriteWarning("Not implemented yet.");
                return(2);
            }
        }
Exemplo n.º 3
0
        internal override async Task <int> RunAsync(CancellationToken cancellationToken)
        {
            var context = await Context
                          .WithAzureLogon()
                          .WithDevOpsLogon()
                          .BuildAsync(cancellationToken);

            var rules = new AggregatorRules(context.Azure, context.Logger);

            if (Local)
            {
                bool ok = await rules.InvokeLocalAsync(Project, Event, WorkItemId, Source, DryRun, SaveMode, ImpersonateExecution, cancellationToken);

                return(ok ? 0 : 1);
            }
            else
            {
                var instance = context.Naming.Instance(Instance, ResourceGroup);
                context.Logger.WriteWarning("Untested feature!");
                bool ok = await rules.InvokeRemoteAsync(Account, Project, Event, WorkItemId, instance, Name, DryRun, SaveMode, ImpersonateExecution, cancellationToken);

                return(ok ? 0 : 1);
            }
        }