Example #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));
        }
        public EmailNotificationService()
        {
            log = LogManager.GetLogger(typeof (EmailNotificationService));
            smtpClient = new SmtpClient();

            var deployStatusConfiguration = DeployStatusSettingsSection.Settings.AsDeployConfiguration();
            performEmailNotificationCheckOnStartup = deployStatusConfiguration.PerformEmailNotificationsCheckOnStartup;
            var trelloApiConfiguration = deployStatusConfiguration.Trello;
            reportAfterDaysInColumn = trelloApiConfiguration.EmailNotificationConfiguration.ReportAfterDaysInColumn;
            trelloClient = new TrelloClient(trelloApiConfiguration);
            deployEmailAddress = trelloApiConfiguration.EmailResolver.GetEmail("deployalready");

            pollAtTime = new TimeSpan(9, 00, 00);

            timer = new Timer(SendEmailsIfNecessary);
        }
        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);
        }
Example #5
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));
        }