Пример #1
0
        public override async Task Execute(string[] parameters, IResponse response)
        {
            var apiKey = Environment.GetEnvironmentVariable("OCTOPUS_API_KEY");
            if (string.IsNullOrWhiteSpace(apiKey))
            {
                await response.Send("Octopus Deploy API key has not been configured. Please set it as environment variable `OCTOPUS_API_KEY`");
            }
            else
            {
                var octopusProject = parameters[1];
                var canonicalProject = parameters[2];
                var group = parameters[3];
                await response.Send($"Got it! Creating project {octopusProject} for repo {canonicalProject} in group {@group}.");

                var facade = new Facade(apiKey, new TeamCityArtifactTemplateRepository());

                var url = facade.CreateProject(canonicalProject, group, octopusProject);

                await response.Send($"Done! Check out the new project here {url}");
            }
        }