コード例 #1
0
ファイル: Program.cs プロジェクト: thedersen/ConDep
        static void Main(string[] args)
        {
            var exitCode = 0;
            try
            {
                new LogConfigLoader().Load();
                Logger.LogSectionStart("ConDep");

                var optionHandler = new CommandLineOptionHandler(args);
                var configAssemblyLoader = new ConDepAssemblyHandler(optionHandler.Params.AssemblyName);
                var assembly = configAssemblyLoader.GetConfigAssembly();

                var conDepOptions = new ConDepOptions(optionHandler.Params.Context, optionHandler.Params.DeployOnly, optionHandler.Params.InfraOnly, optionHandler.Params.WebDeployExist);
                var envSettings = GetEnvConfig(optionHandler.Params, assembly);

                var status = new WebDeploymentStatus();
                ConDepConfigurationExecutor.ExecuteFromAssembly(assembly, envSettings, conDepOptions, status);

                if(status.HasErrors)
                {
                    exitCode = 1;
                }
                else
                {
                    status.EndTime = DateTime.Now;
                    status.PrintSummery();
                }
            }
            catch (Exception ex)
            {
                exitCode = 1;
                Logger.Error("ConDep reported a fatal error:");
                Logger.Error("Message: " + ex.Message);
                Logger.Error("Stack trace:\n" + ex.StackTrace);
            }
            finally
            {
                Logger.LogSectionEnd("ConDep");
                Environment.Exit(exitCode);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: brigs/ConDep
        static void Main(string[] args)
        {
            var      exitCode = 0;
            WebQueue webQ     = null;

            try
            {
                new LogConfigLoader().Load();
                Logger.TraceLevel = TraceLevel.Info;

                var optionHandler = new CommandLineOptionHandler(args);
                if (optionHandler.Params.InstallWebQ)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    PrintCopyrightMessage();
                    Logger.LogSectionStart("ConDep");
                    if (!string.IsNullOrWhiteSpace(optionHandler.Params.WebQAddress))
                    {
                        webQ = new WebQueue(optionHandler.Params.WebQAddress, optionHandler.Params.Environment);
                        webQ.WebQueuePositionUpdate += (sender, eventArgs) => Logger.Info(eventArgs.Message);
                        webQ.WebQueueTimeoutUpdate  += (sender, eventArgs) => Logger.Info(eventArgs.Message);
                        Logger.LogSectionStart("Waiting in Deployment Queue");
                        try
                        {
                            webQ.WaitInQueue(TimeSpan.FromMinutes(30));
                        }
                        finally
                        {
                            Logger.LogSectionEnd("Waiting in Deployment Queue");
                        }
                    }

                    var configAssemblyLoader = new ConDepAssemblyHandler(optionHandler.Params.AssemblyName);
                    var assembly             = configAssemblyLoader.GetAssembly();

                    var conDepOptions = new ConDepOptions(optionHandler.Params.DeployAllApps,
                                                          optionHandler.Params.Application,
                                                          optionHandler.Params.DeployOnly,
                                                          optionHandler.Params.WebDeployExist,
                                                          optionHandler.Params.StopAfterMarkedServer,
                                                          optionHandler.Params.ContinueAfterMarkedServer,
                                                          assembly);
                    var envSettings = ConfigHandler.GetEnvConfig(optionHandler.Params.Environment, optionHandler.Params.BypassLB, assembly);

                    var status = new WebDeploymentStatus();
                    ConDepConfigurationExecutor.ExecuteFromAssembly(assembly, envSettings, conDepOptions, status);

                    if (status.HasErrors)
                    {
                        exitCode = 1;
                    }
                    else
                    {
                        status.EndTime = DateTime.Now;
                        status.PrintSummary();
                    }
                }
            }
            catch (Exception ex)
            {
                exitCode = 1;
                Logger.Error("ConDep reported a fatal error:");
                Logger.Error("Message: " + ex.Message);
                Logger.Verbose("Stack trace:\n" + ex.StackTrace);
            }
            finally
            {
                if (webQ != null)
                {
                    webQ.LeaveQueue();
                }

                Logger.LogSectionEnd("ConDep");
                Environment.Exit(exitCode);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: brigs/ConDep
        static void Main(string[] args)
        {
            var exitCode = 0;
            WebQueue webQ = null;
            try
            {
                new LogConfigLoader().Load();
                Logger.TraceLevel = TraceLevel.Info;

                var optionHandler = new CommandLineOptionHandler(args);
                if (optionHandler.Params.InstallWebQ)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    PrintCopyrightMessage();
                    Logger.LogSectionStart("ConDep");
                    if (!string.IsNullOrWhiteSpace(optionHandler.Params.WebQAddress))
                    {
                        webQ = new WebQueue(optionHandler.Params.WebQAddress, optionHandler.Params.Environment);
                        webQ.WebQueuePositionUpdate += (sender, eventArgs) => Logger.Info(eventArgs.Message);
                        webQ.WebQueueTimeoutUpdate += (sender, eventArgs) => Logger.Info(eventArgs.Message);
                        Logger.LogSectionStart("Waiting in Deployment Queue");
                        try
                        {
                            webQ.WaitInQueue(TimeSpan.FromMinutes(30));
                        }
                        finally
                        {
                            Logger.LogSectionEnd("Waiting in Deployment Queue");
                        }
                    }

                    var configAssemblyLoader = new ConDepAssemblyHandler(optionHandler.Params.AssemblyName);
                    var assembly = configAssemblyLoader.GetAssembly();

                    var conDepOptions = new ConDepOptions(optionHandler.Params.DeployAllApps,
                                                          optionHandler.Params.Application,
                                                          optionHandler.Params.DeployOnly,
                                                          optionHandler.Params.WebDeployExist,
                                                          optionHandler.Params.StopAfterMarkedServer,
                                                          optionHandler.Params.ContinueAfterMarkedServer,
                                                          assembly);
                    var envSettings = ConfigHandler.GetEnvConfig(optionHandler.Params.Environment, optionHandler.Params.BypassLB, assembly);

                    var status = new WebDeploymentStatus();
                    ConDepConfigurationExecutor.ExecuteFromAssembly(assembly, envSettings, conDepOptions, status);

                    if (status.HasErrors)
                    {
                        exitCode = 1;
                    }
                    else
                    {
                        status.EndTime = DateTime.Now;
                        status.PrintSummary();
                    }
                }
            }
            catch (Exception ex)
            {
                exitCode = 1;
                Logger.Error("ConDep reported a fatal error:");
                Logger.Error("Message: " + ex.Message);
                Logger.Verbose("Stack trace:\n" + ex.StackTrace);
            }
            finally
            {
                if(webQ != null)
                {
                    webQ.LeaveQueue();
                }

                Logger.LogSectionEnd("ConDep");
                Environment.Exit(exitCode);
            }
        }