예제 #1
0
        private static async Task DumpTimeline(string project, int buildId)
        {
            var server = new AzureServer(Organization);

            var timeline = await server.GetTimeline(project, buildId);

            await DumpTimeline("", timeline);

            async Task DumpTimeline(string indent, Timeline timeline)
            {
                foreach (var record in timeline.Records)
                {
                    Console.WriteLine($"{indent}Record {record.Name}");
                    if (record.Issues != null)
                    {
                        foreach (var issue in record.Issues)
                        {
                            Console.WriteLine($"{indent}{issue.Type} {issue.Category} {issue.Message}");
                        }
                    }

                    if (record.Details is object)
                    {
                        var nextIndent  = indent + "\t";
                        var subTimeline = await server.GetTimeline(project, buildId, record.Details.Id, record.Details.ChangeId);
                        await DumpTimeline(nextIndent, subTimeline);
                    }
                }
            }
        }
예제 #2
0
        private static async Task DumpBuild(string project, int buildId)
        {
            var server = new AzureServer(Organization);
            var output = @"e:\temp\logs";

            Directory.CreateDirectory(output);
            foreach (var log in await server.GetBuildLogs(project, buildId))
            {
                var logFilePath = Path.Combine(output, $"{log.Id}.txt");
                Console.WriteLine($"Log Id {log.Id} {log.Type} - {logFilePath}");
                var content = await server.GetBuildLog(project, buildId, log.Id);

                File.WriteAllText(logFilePath, content);
            }
        }
예제 #3
0
        private static async Task Fun()
        {
            var server  = new AzureServer(Organization);
            var project = "public";
            var builds  = await server.ListBuild(project, definitions : new[] { 15 }, top : 10);

            foreach (var build in builds)
            {
                Console.WriteLine($"{build.Id} {build.Uri}");
                var artifacts = await server.ListArtifacts(project, build.Id);

                foreach (var artifact in artifacts)
                {
                    Console.WriteLine($"\t{artifact.Id} {artifact.Name} {artifact.Resource.Type}");
                }
            }
        }
예제 #4
0
        public IServerType Create(ServerConfig config)
        {
            IServerType server;

            switch (config.ServerType)
            {
            case ServerConfig.AZURE:
                server = new AzureServer(config);
                break;

            case ServerConfig.AWS:
                server = new AWSBucketServer(config);
                break;

            default:
                server = new LocalServer(config);
                break;
            }
            return(server);
        }