예제 #1
0
        public static bool Execute(string[] args, Stream outputStream)
        {
            var sessionId = Guid.NewGuid().ToString();
            var machineId = getMachineId();

            // Create AppInsights telemetry client to track app usage
            TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
            TelemetryClient.Context.User.Id    = machineId;
            TelemetryClient.Context.Session.Id = sessionId;

            Assembly        assembly        = Assembly.GetAssembly(typeof(DeploymentWorker));
            FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
            var             version         = fileVersionInfo.ProductVersion;

            TelemetryClient.TrackEvent("DeployStart", new Dictionary <string, string>()
            {
                { "AppVersion", version }
            });

            var worker = new DeploymentWorker(outputStream);

            if (!worker.argsHandler.HandleCommandLineArgs(args))
            {
                TelemetryClient.TrackEvent("DeployFailed_IncorrectArgs", new Dictionary <string, string>()
                {
                });
                TelemetryClient.Flush();
                return(false);
            }

            worker.OutputMessage(Resource.DeploymentWorker_Starting);
            var taskResult = worker.CreateAndDeployApp();

            if (taskResult)
            {
                TelemetryClient.TrackEvent("DeploySucceeded", new Dictionary <string, string>()
                {
                });
            }
            else
            {
                TelemetryClient.TrackEvent("DeployFailed", new Dictionary <string, string>()
                {
                });
            }

            TelemetryClient.Flush();
            return(taskResult);
        }
예제 #2
0
        public static bool Execute(string[] args, Stream outputStream)
        {
            var sessionId = Guid.NewGuid().ToString();
            var machineId = getMachineId();
            // Create AppInsights telemetry client to track app usage
            TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
            TelemetryClient.Context.User.Id = machineId;
            TelemetryClient.Context.Session.Id = sessionId;

            Assembly assembly = Assembly.GetAssembly(typeof(DeploymentWorker));
            FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version = fileVersionInfo.ProductVersion;
            TelemetryClient.TrackEvent("DeployStart", new Dictionary<string, string>()
            {
                { "AppVersion", version }
            });

            var worker = new DeploymentWorker(outputStream);
            if (!worker.argsHandler.HandleCommandLineArgs(args))
            {
                TelemetryClient.TrackEvent("DeployFailed_IncorrectArgs", new Dictionary<string, string>() { });
                TelemetryClient.Flush();
                return false;
            }

            worker.OutputMessage(Resource.DeploymentWorker_Starting);
            var taskResult = worker.CreateAndDeployApp();
            if (taskResult)
            {
                TelemetryClient.TrackEvent("DeploySucceeded", new Dictionary<string, string>() { });
            }
            else
            {
                TelemetryClient.TrackEvent("DeployFailed", new Dictionary<string, string>() { });
            }

            TelemetryClient.Flush();
            return taskResult;
        }
예제 #3
0
 public CommandLineParser(DeploymentWorker worker)
 {
     DeploymentWorker = worker;
     Arguments = new List<ArgumentHelper>();
 }
예제 #4
0
 public CommandLineParser(DeploymentWorker worker)
 {
     DeploymentWorker = worker;
     Arguments        = new List <ArgumentHelper>();
 }