static int Main(string[] args) { // Turn flag on in app.config to wait for debugger on launch if (ConfigurationManager.AppSettings["WaitForDebuggerOnStart"] == "true") { while (!Debugger.IsAttached) { System.Threading.Thread.Sleep(100); } } if (args.Length < 2) { System.Console.WriteLine("Usage: kudu.exe appRoot wapTargets [deployer]"); return(1); } // The post receive hook launches the exe from sh and intereprets newline differently. // This fixes very wacky issues with how the output shows up in the conosle on push System.Console.Error.NewLine = "\n"; System.Console.Out.NewLine = "\n"; System.Environment.SetEnvironmentVariable("GIT_DIR", null, System.EnvironmentVariableTarget.Process); var appRoot = args[0]; var wapTargets = args[1]; string deployer = args.Length == 2 ? null : args[2]; string nugetCachePath = null; IEnvironment env = GetEnvironment(appRoot, nugetCachePath); var settings = new XmlSettings.Settings(GetSettingsPath(env)); var settingsManager = new DeploymentSettingsManager(settings); // Setup the trace TraceLevel level = settingsManager.GetTraceLevel(); var tracer = GetTracer(env, level); var traceFactory = new TracerFactory(() => tracer); // Calculate the lock path string lockPath = Path.Combine(env.SiteRootPath, Constants.LockPath); string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile); var deploymentLock = new LockFile(traceFactory, deploymentLockPath); var fs = new FileSystem(); var buildPropertyProvider = new BuildPropertyProvider(); var serverRepository = new GitDeploymentRepository(env.RepositoryPath, env.SiteRootPath, traceFactory); var builderFactory = new SiteBuilderFactory(settingsManager, buildPropertyProvider, env); var logger = new ConsoleLogger(); var deploymentManager = new DeploymentManager(serverRepository, builderFactory, env, fs, traceFactory, settingsManager, deploymentLock, GetLogger(env, level, logger)); var step = tracer.Step("Executing external process", new Dictionary <string, string> { { "type", "process" }, { "path", "kudu.exe" }, { "arguments", appRoot + " " + wapTargets } }); using (step) { try { deploymentManager.Deploy(deployer); } catch { System.Console.Error.WriteLine(Resources.Log_DeploymentError); throw; } } if (logger.HasErrors) { System.Console.Error.WriteLine(Resources.Log_DeploymentError); return(1); } return(0); }
static int Main(string[] args) { if (args.Length < 2) { System.Console.WriteLine("Usage: kudu.exe appRoot wapTargets [deployer]"); return(1); } // The post receive hook launches the exe from sh and intereprets newline differently. // This fixes very wacky issues with how the output shows up in the conosle on push System.Console.Error.NewLine = "\n"; System.Console.Out.NewLine = "\n"; System.Environment.SetEnvironmentVariable("GIT_DIR", null, System.EnvironmentVariableTarget.Process); var appRoot = args[0]; var wapTargets = args[1]; string deployer = args.Length == 2 ? null : args[2]; string nugetCachePath = null; IEnvironment env = GetEnvironment(appRoot, nugetCachePath); // Setup the trace string tracePath = Path.Combine(env.ApplicationRootPath, Constants.TracePath, Constants.TraceFile); var tracer = new Tracer(tracePath); var traceFactory = new TracerFactory(() => tracer); // Calculate the lock path string lockPath = Path.Combine(env.ApplicationRootPath, Constants.LockPath); string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile); var deploymentLock = new LockFile(traceFactory, deploymentLockPath); var fs = new FileSystem(); var buildPropertyProvider = new BuildPropertyProvider(wapTargets); var builderFactory = new SiteBuilderFactory(buildPropertyProvider, env); var serverRepository = new GitDeploymentRepository(env.DeploymentRepositoryPath, traceFactory); var logger = new ConsoleLogger(); var deploymentManager = new DeploymentManager(serverRepository, builderFactory, env, fs, traceFactory, deploymentLock, logger); var step = tracer.Step("Executing external process", new Dictionary <string, string> { { "type", "process" }, { "path", "kudu.exe" }, { "arguments", appRoot + " " + wapTargets } }); using (step) { try { deploymentManager.Deploy(deployer); } catch { System.Console.Error.WriteLine(Resources.Log_DeploymentError); throw; } } if (logger.HasErrors) { System.Console.Error.WriteLine(Resources.Log_DeploymentError); return(1); } return(0); }
private GitDeploymentRepository GetGitDeploymentRepo(Uri origin = null) { var repo = new GitDeploymentRepository(Config.GitRepositoryDirectory, origin); return(repo); }