public RMReleaseTemplateRepository(string connectionString, string templateName, string templateStage, RMVersion version)
 {
     this.connectionString = connectionString;
     this.templateName = templateName;
     this.templateStage = templateStage;
     this.version = version;
 }
コード例 #2
0
 public RMReleaseTemplateRepository(string connectionString, string templateName, string templateStage, RMVersion version)
 {
     this.connectionString = connectionString;
     this.templateName     = templateName;
     this.templateStage    = templateStage;
     this.version          = version;
 }
コード例 #3
0
        private static async Task <RMDeploymentSequence> RetrieveWorkflow(RMVersion version)
        {
            var repository = new RMReleaseTemplateRepository(
                options.ConnectionString,
                options.TemplateName,
                options.TemplateStage,
                version);

            PrintOnlyIfVerbose($"{Environment.NewLine}Connecting to the DB '{options.DatabaseName}' on the SQL server '{options.SqlServerName}'");

            // get the workflow
            var workflow = await repository.GetDeploymentSequence();

            return(workflow);
        }
コード例 #4
0
        private static async Task RetrieveWorkflowAndGenerateScript(RMVersion version, string releaseTemplateName, string releaseTemplateStage)
        {
            var workflow = await RetrieveWorkflow(version, releaseTemplateName, releaseTemplateStage);

            if (workflow != null)
            {
                PrintOnlyIfVerbose($"Generating the scripts for the workflow '{releaseTemplateName}' stage '{releaseTemplateStage}' into folder '{options.OutputFolder}'{Environment.NewLine}");
                var scriptGenerator = ConfigureScriptGenerator(version);

                DeploymentSequence sequence;
                PrintOnlyIfVerbose("Parsing release template");
                try
                {
                    sequence = workflow.ToReleaseTemplate();
                }
                catch (UnsupportedReleaseTemplateTypeException)
                {
                    Console.WriteLine(
                        $"Error: {options.TemplateName} is a vNext template. vNext release templates are unsupported. Please refer to the documentation for guidance on migrating vNext release templates.");
                    return;
                }

                PrintOnlyIfVerbose("Done parsing release template");

                PrintOnlyIfVerbose("Generating PowerShell");
                await scriptGenerator.GenerateScriptAsync(sequence, options.OutputFolder);

                PrintOnlyIfVerbose("Done generating PowerShell");

                Console.WriteLine($"{Environment.NewLine}Release workflow generated");

                scriptGenerator.ScriptGenerationNotification -= PrintGeneratorEvents;
                ActionParser.ActionParsed       -= PrintActionEvents;
                ContainerParser.ContainerParsed -= PrintContainerEvents;
            }
            else
            {
                Console.WriteLine(
                    $"{Environment.NewLine}No Results returned for TemplateName: '{0}' and StageName: '{1}'\n",
                    options.TemplateName,
                    options.TemplateStage);
            }
        }
コード例 #5
0
        private static ScriptGenerator ConfigureScriptGenerator(RMVersion version)
        {
            // make sure we have the output folder
            var fs = new FileSystem();

            fs.CreateDirectory(options.OutputFolder);

            var scriptGenerator = new ScriptGenerator(
                fs,
                new RMComponentRepository(options.ConnectionString, version),
                new RMUserRepository(options.ConnectionString, version),
                new RMDeployerToolRepository(options.ConnectionString, version),
                !options.CreateParameterizedScripts);

            // enable full logging
            scriptGenerator.ScriptGenerationNotification += PrintGeneratorEvents;
            ActionParser.ActionParsed       += PrintActionEvents;
            ContainerParser.ContainerParsed += PrintContainerEvents;
            return(scriptGenerator);
        }
コード例 #6
0
        private static ScriptGenerator ConfigureScriptGenerator(RMVersion version)
        {
            PrintOnlyIfVerbose($"Generating the scripts for the workflow '{options.TemplateName}' stage '{options.TemplateStage}' into folder '{options.OutputFolder}'{Environment.NewLine}");

            // make sure we have the output folder
            var fs = new FileSystem();

            fs.CreateDirectory(options.OutputFolder);

            var scriptGenerator = new ScriptGenerator(
                fs,
                new RMComponentRepository(options.ConnectionString, version),
                new RMUserRepository(options.ConnectionString, version),
                new RMDeployerToolRepository(options.ConnectionString, version),
                !options.CreateParameterizedScripts);

            // enable full logging
            scriptGenerator.ScriptGenerationNotification += PrintGeneratorEvents;
            ActionParser.ActionParsed       += PrintActionEvents;
            ContainerParser.ContainerParsed += PrintContainerEvents;
            return(scriptGenerator);
        }
 public RMDeployerToolRepository(string connectionString, RMVersion version)
 {
     this.connectionString = connectionString;
     this.tableNamePrefix = version == RMVersion.Rm2015 ? "RM.tbl_" : "dbo.";
 }
 public RMUserRepository(string connectionString, RMVersion version)
 {
     this.connectionString = connectionString;
     this.tableNamePrefix = version == RMVersion.Rm2015 ? "RM.tbl_" : "dbo.";
 }
コード例 #9
0
        private static async Task<RMDeploymentSequence> RetrieveWorkflow(RMVersion version, string releaseTemplateName, string releaseTemplateStage)
        {
            var repository = new RMReleaseTemplateRepository(
                options.ConnectionString,
                version);

            PrintOnlyIfVerbose($"{Environment.NewLine}Connecting to the DB '{options.DatabaseName}' on the SQL server '{options.SqlServerName}'");

            // get the workflow
            var workflow = await repository.GetDeploymentSequence(releaseTemplateName, releaseTemplateStage);
            workflow.ReleaseTemplateName = releaseTemplateName;
            workflow.ReleaseTemplateStageName = releaseTemplateStage;
            return workflow;
        }
コード例 #10
0
        private static ScriptGenerator ConfigureScriptGenerator(RMVersion version)
        {
           

            // make sure we have the output folder
            var fs = new FileSystem();
            fs.CreateDirectory(options.OutputFolder);

            var scriptGenerator = new ScriptGenerator(
                fs,
                new RMComponentRepository(options.ConnectionString, version),
                new RMUserRepository(options.ConnectionString, version),
                new RMDeployerToolRepository(options.ConnectionString, version),
                !options.CreateParameterizedScripts);

            // enable full logging
            scriptGenerator.ScriptGenerationNotification += PrintGeneratorEvents;
            ActionParser.ActionParsed += PrintActionEvents;
            ContainerParser.ContainerParsed += PrintContainerEvents;
            return scriptGenerator;
        }
コード例 #11
0
        private static async Task RetrieveWorkflowAndGenerateScript(RMVersion version, string releaseTemplateName, string releaseTemplateStage)
        {
            var workflow = await RetrieveWorkflow(version, releaseTemplateName, releaseTemplateStage);
            if (workflow != null)
            {
                PrintOnlyIfVerbose($"Generating the scripts for the workflow '{releaseTemplateName}' stage '{releaseTemplateStage}' into folder '{options.OutputFolder}'{Environment.NewLine}");
                var scriptGenerator = ConfigureScriptGenerator(version);

                DeploymentSequence sequence;
                PrintOnlyIfVerbose("Parsing release template");
                try
                {
                    sequence = workflow.ToReleaseTemplate();
                }
                catch (UnsupportedReleaseTemplateTypeException)
                {
                    Console.WriteLine(
                        $"Error: {options.TemplateName} is a vNext template. vNext release templates are unsupported. Please refer to the documentation for guidance on migrating vNext release templates.");
                    return;
                }

                PrintOnlyIfVerbose("Done parsing release template");

                PrintOnlyIfVerbose("Generating PowerShell");
                await scriptGenerator.GenerateScriptAsync(sequence, options.OutputFolder);
                PrintOnlyIfVerbose("Done generating PowerShell");

                Console.WriteLine($"{Environment.NewLine}Release workflow generated");

                scriptGenerator.ScriptGenerationNotification -= PrintGeneratorEvents;
                ActionParser.ActionParsed -= PrintActionEvents;
                ContainerParser.ContainerParsed -= PrintContainerEvents;
            }
            else
            {
                Console.WriteLine(
                    $"{Environment.NewLine}No Results returned for TemplateName: '{0}' and StageName: '{1}'\n",
                    options.TemplateName,
                    options.TemplateStage);
            }
        }
 public RMReleaseTemplateRepository(string connectionString, RMVersion version)
 {
     this.connectionString = connectionString;
     this.version = version;
 }
 public RMReleaseTemplateRepository(string connectionString, RMVersion version)
 {
     this.connectionString = connectionString;
     this.version          = version;
 }
コード例 #14
0
        private static ScriptGenerator ConfigureScriptGenerator(RMVersion version)
        {
            PrintOnlyIfVerbose($"Generating the scripts for the workflow '{options.TemplateName}' stage '{options.TemplateStage}' into folder '{options.OutputFolder}'{Environment.NewLine}");

            // make sure we have the output folder
            var fs = new FileSystem();
            fs.CreateDirectory(options.OutputFolder);

            var scriptGenerator = new ScriptGenerator(
                fs,
                new RMComponentRepository(options.ConnectionString, version),
                new RMUserRepository(options.ConnectionString, version),
                new RMDeployerToolRepository(options.ConnectionString, version),
                !options.CreateParameterizedScripts);

            // enable full logging
            scriptGenerator.ScriptGenerationNotification += PrintGeneratorEvents;
            ActionParser.ActionParsed += PrintActionEvents;
            ContainerParser.ContainerParsed += PrintContainerEvents;
            return scriptGenerator;
        }