Beispiel #1
0
 public Task Execute()
 {
     return(VsoService.QueueBuildAsync(
                VsoInstance,
                VsoProject,
                BuildDefinitionId,
                VsoParameters));
 }
Beispiel #2
0
        public async Task Post(PushWebHookEvent e)
        {
            Trace.TraceInformation($"CommitPushed Started: {e}");

            try
            {
                if (e.Commits != null)
                {
                    foreach (Commit c in e.Commits)
                    {
                        if (c.modified != null)
                        {
                            foreach (string modified in c.modified)
                            {
                                ModifiedFileModel modifiedFile;
                                if (!ModifiedFileModel.TryParse(e.Repository.Full_Name, e.Ref, modified, out modifiedFile))
                                {
                                    Trace.TraceWarning($"Skipping file '{modified}'");
                                    continue;
                                }

                                List <Task> queueBuildTasks = new List <Task>();
                                foreach (EventRegistration registration in await _eventService.GetRegistrations(modifiedFile))
                                {
                                    queueBuildTasks.Add(
                                        _vsoService.QueueBuildAsync(
                                            registration.VsoInstance,
                                            registration.VsoProject,
                                            registration.BuildDefinitionId,
                                            registration.VsoParameters));
                                }

                                await Task.WhenAll(queueBuildTasks);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError($"An unhandled exception occurred handling PushWebHookEvent {e} : Exception: {ex}");

                throw;
            }

            Trace.TraceInformation("CommitPushed Complete");
        }