Ejemplo n.º 1
0
        public void Handle(VSTSBuild_v1 vstsBuild)
        {
            var vstsClient = new VstsClient(new VstsConnection());

            vstsBuild.MapTo(vstsClient.Connection);

            if (vstsBuild.DefinitionId == null)
            {
                var definition = vstsClient.GetBuildDefinitionAsync(vstsBuild.DefinitionName).Result;

                vstsBuild.DefinitionId = definition.Id;
            }

            var latestBuild = vstsClient.GetLatestBuildAsync(vstsBuild.DefinitionId.Value).Result;

            vstsBuild.State = latestBuild != null ? latestBuild.State : State.Unknown;
        }
Ejemplo n.º 2
0
        public async Task Handle(HealthCheckRequest <VSTSBuild_v1> request, CancellationToken cancellationToken)
        {
            var client = new VstsClient();

            request.DataContext.MapTo(client.Connection);

            if (request.DataContext.DefinitionId == null)
            {
                var definition = await client.GetBuildDefinitionAsync(request.DataContext.DefinitionName).ConfigureAwait(false);

                request.DataContext.DefinitionId = definition.Id;
            }

            var build = await client.GetLatestBuildAsync(request.DataContext.DefinitionId.Value)
                        .ConfigureAwait(false);

            request.DataContext.State = build != null ? build.State : State.Unknown;
        }
Ejemplo n.º 3
0
        public async Task Handle(HealthCheckRequest <VSTSBuild_v1> request, CancellationToken cancellationToken)
        {
            var client = new VstsClient();

            request.DataContext.MapTo(client);

            if (request.DataContext.DefinitionId == null)
            {
                var definition = await client.GetBuildDefinitionAsync(request.DataContext.DefinitionName).ConfigureAwait(false);

                request.DataContext.DefinitionId = definition.Id;
            }

            var builds = await client.Request <Collection <VSTSBuild> >($"build/builds?definitions={request.DataContext.DefinitionId}&$top=1&api-version=2.0").ConfigureAwait(false);

            var build = builds?.Value?.FirstOrDefault();

            request.DataContext.State = build != null ? build.State : State.Unknown;
        }