예제 #1
0
        /// <summary>
        /// Trigger deploys for the provided environment group
        /// </summary>
        /// <param name="picked"></param>
        /// <param name="buildVersion"></param>
        /// <returns></returns>
        private static async Task <Dictionary <int, string> > DeployEnvironmentGroup(EnvironmentGroup picked, string buildVersion)
        {
            Dictionary <int, string> deployments = new Dictionary <int, string>();

            Console.WriteLine("-------------------");
            Console.WriteLine("Starting Deployment");
            Console.WriteLine("-------------------");
            foreach (var env in picked.Environments)
            {
                try
                {
                    Console.Write($"Starting deploy for {env.Name} build version {buildVersion}...");

                    var response = await _appVeyorService.DeployEnvironment(picked.Project, env, buildVersion);

                    deployments.Add(response.DeploymentId, env.Name);

                    Console.WriteLine("Success!");
                }
                catch
                {
                    Console.WriteLine("FAILED!");
                }
            }

            Console.WriteLine();
            Console.WriteLine("Deployments are started.");

            return(deployments);
        }
        /// <summary>
        /// Trigger deploys for the provided environment group
        /// </summary>
        /// <param name="picked"></param>
        /// <param name="buildVersion"></param>
        /// <returns></returns>
        private static async Task DeployEnvironmentGroup(EnvironmentGroup picked, string buildVersion)
        {
            foreach (var env in picked.Environments)
            {
                bool success = await _appVeyorService.DeployEnvironment(picked.Project, env, buildVersion);

                if (success)
                {
                    Console.WriteLine("Success, started deploy to: " + env.Name);
                }
                else
                {
                    Console.WriteLine("FAILED to start deploy to: " + env.Name);
                }
            }

            Console.WriteLine("Deployments are NOT finished yet.");
            Console.WriteLine("Check the progress of your deployements on ci.appveyor.com");
        }