示例#1
0
        public DeployStatusInfoClient(DeployStatusConfiguration configuration)
        {
            octopusClient      = new OctopusClient(configuration.Octopus);
            trelloClient       = new TrelloClient(configuration.Trello);
            teamCityClient     = new TeamCityClient(configuration.TeamCity);
            DeployUserResolver = configuration.DeployUserResolver;

            log = LogManager.GetLogger(typeof(DeployStatusInfoClient));
        }
        public DeployStatusInfoClient(DeployStatusConfiguration configuration)
        {
            octopusClient = new OctopusClient(configuration.Octopus);
            trelloClient = new TrelloClient(configuration.Trello);
            teamCityClient = new TeamCityClient(configuration.TeamCity);
            DeployUserResolver = configuration.DeployUserResolver;

            log = LogManager.GetLogger(typeof (DeployStatusInfoClient));
        }
        private async Task<DeployStatusInfo> GetDeployStatusInfo(TeamCityClient teamCityClient, OctopusEnvironmentInfo environment,
            TrelloClient trelloClient)
        {
            var buildInfo = (await teamCityClient.GetBuildsContaining(new Version(environment.ReleaseVersion))).ToList();

            var branchName = GetBranchNameFromReleaseNotes(environment.ReleaseNotes);
            if (string.IsNullOrWhiteSpace(branchName) && buildInfo.Any())
                branchName = buildInfo.First(x => !string.IsNullOrWhiteSpace(x.BranchName)).BranchName;

            var branchRelatedTrelloCards = Enumerable.Empty<TrelloCardInfo>();
            if (!string.IsNullOrWhiteSpace(branchName))
                branchRelatedTrelloCards = await trelloClient.GetCardsLinkedToBranch(branchName);

            var labelRelatedCards = await trelloClient.GetCardsLinkedToLabel(environment.Name);

            return new DeployStatusInfo(environment, buildInfo, branchRelatedTrelloCards, labelRelatedCards, branchName);
        }
示例#4
0
        private async Task <DeployStatusInfo> GetDeployStatusInfo(TeamCityClient teamCityClient, OctopusEnvironmentInfo environment,
                                                                  TrelloClient trelloClient)
        {
            var buildInfo = (await teamCityClient.GetBuildsContaining(new Version(environment.ReleaseVersion))).ToList();

            var branchName = GetBranchNameFromReleaseNotes(environment.ReleaseNotes);

            if (string.IsNullOrWhiteSpace(branchName) && buildInfo.Any())
            {
                branchName = buildInfo.First(x => !string.IsNullOrWhiteSpace(x.BranchName)).BranchName;
            }

            var branchRelatedTrelloCards = Enumerable.Empty <TrelloCardInfo>();

            if (!string.IsNullOrWhiteSpace(branchName))
            {
                branchRelatedTrelloCards = await trelloClient.GetCardsLinkedToBranch(branchName);
            }

            var labelRelatedCards = await trelloClient.GetCardsLinkedToLabel(environment.Name);

            return(new DeployStatusInfo(environment, buildInfo, branchRelatedTrelloCards, labelRelatedCards, branchName));
        }