예제 #1
0
        public static async Task ExecuteGenerateAsync(OutputContext output, ApplicationBuilder application, string environment, bool interactive)
        {
            await application.ProcessExtensionsAsync(ExtensionContext.OperationKind.Deploy);

            var steps = new List <ServiceExecutor.Step>()
            {
                new CombineStep()
                {
                    Environment = environment,
                },
                new PublishProjectStep(),
                new BuildDockerImageStep()
                {
                    Environment = environment,
                },                                                         // Make an image but don't push it
            };

            steps.Add(new GenerateKubernetesManifestStep()
            {
                Environment = environment,
            });

            Program.ApplyRegistryAndDefaults(output, application, interactive, requireRegistry: false);

            var executor = new ServiceExecutor(output, application, steps);

            foreach (var service in application.Services)
            {
                await executor.ExecuteAsync(service);
            }

            await GenerateApplicationManifestAsync(output, application, environment);
        }
예제 #2
0
        private static async Task ExecutePushAsync(OutputContext output, ApplicationBuilder application, string environment, bool interactive, bool force)
        {
            await application.ProcessExtensionsAsync(output, ExtensionContext.OperationKind.Deploy);

            var steps = new List <ServiceExecutor.Step>()
            {
                new CombineStep()
                {
                    Environment = environment,
                },
                new PublishProjectStep(),
                new BuildDockerImageStep()
                {
                    Environment = environment,
                },
                new PushDockerImageStep()
                {
                    Environment = environment,
                },
            };

            ApplyRegistryAndDefaults(output, application, interactive, requireRegistry: true);

            var executor = new ServiceExecutor(output, application, steps);

            foreach (var service in application.Services)
            {
                await executor.ExecuteAsync(service);
            }
        }
예제 #3
0
        private static async Task ExecuteDeployAsync(OutputContext output, ConfigApplication application, string environment, bool interactive, bool force)
        {
            if (!await KubectlDetector.Instance.IsKubectlInstalled.Value)
            {
                throw new CommandException($"Cannot apply manifests because kubectl is not installed.");
            }

            if (!await KubectlDetector.Instance.IsKubectlConnectedToCluster.Value)
            {
                throw new CommandException($"Cannot apply manifests because kubectl is not connected to a cluster.");
            }

            var temporaryApplication = await CreateApplicationAdapterAsync(output, application, interactive, requireRegistry: true);
            var steps = new List<ServiceExecutor.Step>()
            {
                new CombineStep() { Environment = environment, },
                new PublishProjectStep(),
                new BuildDockerImageStep() { Environment = environment, },
                new PushDockerImageStep() { Environment = environment, },
                new ValidateSecretStep() { Environment = environment, Interactive = interactive, Force = force, },
            };

            steps.Add(new GenerateKubernetesManifestStep() { Environment = environment, });
            steps.Add(new DeployServiceYamlStep() { Environment = environment, });

            var executor = new ServiceExecutor(output, temporaryApplication, steps);
            foreach (var service in temporaryApplication.Services)
            {
                await executor.ExecuteAsync(service);
            }

            await DeployApplicationManifestAsync(output, temporaryApplication, application.Source.Directory.Name, environment);
        }
예제 #4
0
        public static async Task ExecuteGenerateAsync(OutputContext output, ConfigApplication application, string environment, bool interactive)
        {
            var temporaryApplication = await Program.CreateApplicationAdapterAsync(output, application, interactive, requireRegistry : false);

            var steps = new List <ServiceExecutor.Step>()
            {
                new CombineStep()
                {
                    Environment = environment,
                },
                new PublishProjectStep(),
                new BuildDockerImageStep()
                {
                    Environment = environment,
                },                                                         // Make an image but don't push it
            };

            steps.Add(new GenerateKubernetesManifestStep()
            {
                Environment = environment,
            });

            var executor = new ServiceExecutor(output, temporaryApplication, steps);

            foreach (var service in temporaryApplication.Services)
            {
                await executor.ExecuteAsync(service);
            }

            await GenerateApplicationManifestAsync(output, temporaryApplication, application.Name ?? application.Source.Directory.Name, environment);
        }
예제 #5
0
        public static async Task ExecuteBuildAsync(OutputContext output, ConfigApplication application, string environment, bool interactive)
        {
            var temporaryApplication = await Program.CreateApplicationAdapterAsync(output, application, interactive, requireRegistry : false);

            var steps = new List <ServiceExecutor.Step>()
            {
                new CombineStep()
                {
                    Environment = environment,
                },
                new PublishProjectStep(),
                new BuildDockerImageStep()
                {
                    Environment = environment,
                },
            };

            var executor = new ServiceExecutor(output, temporaryApplication, steps);

            foreach (var service in temporaryApplication.Services)
            {
                await executor.ExecuteAsync(service);
            }
        }
예제 #6
0
        public static async Task ExecuteBuildAsync(OutputContext output, ApplicationBuilder application, string environment, bool interactive)
        {
            var steps = new List <ServiceExecutor.Step>()
            {
                new CombineStep()
                {
                    Environment = environment,
                },
                new PublishProjectStep(),
                new BuildDockerImageStep()
                {
                    Environment = environment,
                },
            };

            Program.ApplyRegistryAndDefaults(output, application, interactive, requireRegistry: false);

            var executor = new ServiceExecutor(output, application, steps);

            foreach (var service in application.Services)
            {
                await executor.ExecuteAsync(service);
            }
        }