예제 #1
0
        public async Task <Dictionary <string, bool> > GetAllColdPipelinesCicdStatus()
        {
            var ret = new Dictionary <string, bool>();
            var codePiplelineHelper = new CodePipelineHelper(GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color);
            var codePipelines       = await codePiplelineHelper.GetCodePipelineList();

            foreach (var codePipeline in codePipelines)
            {
                if (codePipeline.Name.Contains("level-2"))
                {
                    ret.Add(codePipeline.Name, await codePiplelineHelper.GetCodePipelineStageTransitionStatus(codePipeline.Name, "Phase1"));
                }
                else if (codePipeline.Name.Contains("level-3"))
                {
                    ret.Add(codePipeline.Name, await codePiplelineHelper.GetCodePipelineStageTransitionStatus(codePipeline.Name, "Beanstalk"));
                }
            }
            return(ret);
        }
예제 #2
0
        public async Task SwitchLevel2CicdMode()
        {
            var codePiplelineHelper = new CodePipelineHelper(GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color);
            var codePipeline        = (await codePiplelineHelper.GetCodePipelineList()).Find(o => o.Name.Contains("level-2"));

            if (codePipeline == null)
            {
                throw new Exception($"Can't find code pipeline {GlobalVariables.Enviroment}-level-2-{GlobalVariables.Color}!");
            }
            var enabled = await codePiplelineHelper.GetCodePipelineStageTransitionStatus(codePipeline.Name, "Phase1");

            if (enabled)
            {
                await codePiplelineHelper.DisableTransition(codePipeline.Name, "Phase1", "Disabled until deployment is ready.");
            }
            else
            {
                await codePiplelineHelper.EnableTransition(codePipeline.Name, "Phase1");
            }
        }
예제 #3
0
        public async Task SwitchLevel3CicdMode()
        {
            var codePiplelineHelper = new CodePipelineHelper(GlobalVariables.Enviroment, GlobalVariables.Region, GlobalVariables.Color);
            var codePipelines       = (await codePiplelineHelper.GetCodePipelineList()).FindAll(o => o.Name.Contains("level-3"));

            if (codePipelines == null || codePipelines.Count == 0)
            {
                throw new Exception($"Can't find code pipeline {GlobalVariables.Enviroment}-level-2-{GlobalVariables.Color}!");
            }
            foreach (var codePipeline in codePipelines)
            {
                var enabled = await codePiplelineHelper.GetCodePipelineStageTransitionStatus(codePipeline.Name, "Beanstalk");

                if (enabled)
                {
                    await codePiplelineHelper.DisableTransition(codePipeline.Name, "Beanstalk", "Disabled until deployment is ready.");
                }
                else
                {
                    await codePiplelineHelper.EnableTransition(codePipeline.Name, "Beanstalk");
                }
            }
        }