private string InitialiseBuildRun(string sourcePath, string project) { var tasksDestinationPath = Path.Combine(ConfigurationManager.AppSettings["tasksRunnerRootPath"], project); //root path for the source task artifacts var tasksSourcePath = sourcePath; //create new directory for tasks to run if (!Directory.Exists(tasksDestinationPath)) { Directory.CreateDirectory(tasksDestinationPath); } int latestCount = GetNextBuildNumber(tasksDestinationPath); var runPath = Path.Combine(tasksDestinationPath, string.Format("{0}", latestCount)); Directory.CreateDirectory(runPath); //generate basic log to identify task run string path = Path.Combine(runPath, string.Format("{0}", WebConfigurationManager.AppSettings[BUILD_LOG_DATA_FILE])); // This text is added only once to the file. if (!System.IO.File.Exists(path)) { // Create a file to write to. using (StreamWriter sw = System.IO.File.CreateText(path)) { sw.WriteLine(string.Format("{0} Ver: {1}", "Build Runner version", "2.1")); sw.WriteLine(string.Format("{0} {1}", DateTime.UtcNow, runPath)); } } //copy all build version specific definition files to latest build running path DirectoryClient.DirectoryCopy(tasksSourcePath, runPath, true); FileClient.CreateZipFromDirectory(tasksSourcePath, Path.Combine(runPath, WebConfigurationManager.AppSettings[TASK_DEFINITIONS_ARCHIVE])); return(runPath); }
private string InitialiseBuildRun() { var tasksDestinationPath = ConfigurationManager.AppSettings["tasksRunnerRootPath"]; //root path for the source task artifacts var tasksSourcePath = ConfigurationManager.AppSettings["tasksSourcePath"]; //create new directory for tasks to run if (!Directory.Exists(tasksDestinationPath)) { Directory.CreateDirectory(tasksDestinationPath); } int latestCount = GetNextBuildNumber(tasksDestinationPath); var runPath = Path.Combine(tasksDestinationPath, string.Format("{0}", latestCount)); Directory.CreateDirectory(runPath); //generate basic log to identify task run string path = Path.Combine(runPath, string.Format("{0}", "build.log")); // This text is added only once to the file. if (!File.Exists(path)) { // Create a file to write to. using (StreamWriter sw = File.CreateText(path)) { sw.WriteLine(string.Format("{0} Ver: {1}", "Build Runner version", "2.1")); sw.WriteLine(string.Format("{0} {1}", DateTime.UtcNow, runPath)); } } //copy build artifacts DirectoryClient.DirectoryCopy(tasksSourcePath, runPath, true); return(runPath); }