コード例 #1
0
        public TrucksSampleCommand(IOctopusClientFactory octopusClientFactory)
            : base(octopusClientFactory)
        {
            var options = Options.For("Trucks sample");

            options.Add("trucks=", $"[Optional] Number of trucks to create, default {DefaultNumberOfTrucks}", v => NumberOfTrucks = int.Parse(v));
        }
コード例 #2
0
 public DummyApiCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Dummy");
     options.Add("pill=", "Red or Blue. Blue, the story ends. Red, stay in Wonderland and see how deep the rabbit hole goes.", v => pill = v);
     log.Debug("Pill: " + pill);
 }
コード例 #3
0
        public SimpleProjectSampleCommand(IOctopusClientFactory octopusClientFactory)
            : base(octopusClientFactory)
        {
            var options = Options.For("Simple Project sample");

            options.Add("count=", $"[Optional] Number of projects to create, default {DefaultNumberOfProjects}", v => NumberOfProjects = int.Parse(v));
        }
コード例 #4
0
 public CreateEnvironmentCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Environment creation");
     options.Add("name=", "The name of the environment", v => EnvironmentName = v);
     options.Add("ignoreIfExists", "If the environment already exists, an error will be returned. Set this flag to ignore the error.", v => IgnoreIfExists = true);
 }
コード例 #5
0
        protected ApiCommand(IOctopusClientFactory clientFactory, IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, ICommandOutputProvider commandOutputProvider) : base(commandOutputProvider)
        {
            this.clientFactory     = clientFactory;
            this.repositoryFactory = repositoryFactory;
            this.FileSystem        = fileSystem;

            var options = Options.For("Common options");

            options.Add("server=", $"[Optional] The base URL for your Octopus Server, e.g., 'https://octopus.example.com/'. This URL can also be set in the {ServerUrlEnvVar} environment variable.", v => serverBaseUrl = v);
            options.Add("apiKey=", $"[Optional] Your API key. Get this from the user profile page. Your must provide an apiKey or username and password. If the guest account is enabled, a key of API-GUEST can be used. This key can also be set in the {ApiKeyEnvVar} environment variable.", v => apiKey = v);
            options.Add("user="******"[Optional] Username to use when authenticating with the server. Your must provide an apiKey or username and password. This Username can also be set in the {UsernameEnvVar} environment variable.", v => username = v);
            options.Add("pass="******"[Optional] Password to use when authenticating with the server. This Password can also be set in the {PasswordEnvVar} environment variable.", v => password = v);

            options.Add("configFile=", "[Optional] Text file of default values, with one 'key = value' per line.", v => ReadAdditionalInputsFromConfigurationFile(v));
            options.Add("debug", "[Optional] Enable debug logging", v => enableDebugging = true);
            options.Add("ignoreSslErrors", "[Optional] Set this flag if your Octopus Server uses HTTPS but the certificate is not trusted on this machine. Any certificate errors will be ignored. WARNING: this option may create a security vulnerability.", v => ignoreSslErrors = true);
            options.Add("enableServiceMessages", "[Optional] Enable TeamCity or Team Foundation Build service messages when logging.", v => commandOutputProvider.EnableServiceMessages());
            options.Add("timeout=", $"[Optional] Timeout in seconds for network operations. Default is {ApiConstants.DefaultClientRequestTimeout/1000}.", v => clientOptions.Timeout = TimeSpan.FromSeconds(int.Parse(v)));
            options.Add("proxy=", $"[Optional] The URL of the proxy to use, e.g., 'https://proxy.example.com'.", v => clientOptions.Proxy = v);
            options.Add("proxyUser="******"[Optional] The username for the proxy.", v => clientOptions.ProxyUsername = v);
            options.Add("proxyPass="******"[Optional] The password for the proxy. If both the username and password are omitted and proxyAddress is specified, the default credentials are used. ", v => clientOptions.ProxyPassword = v);
            options.Add("space=", $"[Optional] The name or ID of a space within which this command will be executed. The default space will be used if it is omitted. ", v => spaceNameOrId = v);
#if NETFRAMEWORK
            options.Add("keepalive=", "[Optional] How frequently (in seconds) to send a TCP keepalive packet.", input => keepAlive = int.Parse(input) * 1000);
#endif
            options.AddLogLevelOptions();
        }
コード例 #6
0
ファイル: ApiCommand.cs プロジェクト: scrummyin/Octopus-Tools
        protected ApiCommand(IOctopusClientFactory clientFactory, ILog log)
        {
            this.clientFactory = clientFactory;
            this.log = log;

            client = new Lazy<IOctopusClient>(CreateAndInitializeClient);
        }
コード例 #7
0
 public DeployPublisher(IDiscordBot bot, IOctopusClientFactory octopusClientFactory, OctopusServerEndpoint octopusServerEndpoint, ILogger <DeployPublisher> logger)
 {
     this._bot = bot ?? throw new ArgumentNullException(nameof(bot));
     this._octopusClientFactory  = octopusClientFactory ?? throw new ArgumentNullException(nameof(octopusClientFactory));
     this._octopusServerEndpoint = octopusServerEndpoint ?? throw new ArgumentNullException(nameof(octopusServerEndpoint));
     this._logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
コード例 #8
0
        protected DeploymentCommandBase(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            SpecificMachineNames = new List<string>();
            SkipStepNames = new List<string>();
            DeployToEnvironmentNames = new List<string>();
            TenantTags = new List<string>();
            Tenants = new List<string>();

            var options = Options.For("Deployment");
            options.Add("progress", "[Optional] Show progress of the deployment", v => { showProgress = true; WaitForDeployment = true; noRawLog = true; });
            options.Add("forcepackagedownload", "[Optional] Whether to force downloading of already installed packages (flag, default false).", v => ForcePackageDownload = true);
            options.Add("waitfordeployment", "[Optional] Whether to wait synchronously for deployment to finish.", v => WaitForDeployment = true);
            options.Add("deploymenttimeout=", "[Optional] Specifies maximum time (timespan format) that the console session will wait for the deployment to finish(default 00:10:00). This will not stop the deployment. Requires --waitfordeployment parameter set.", v => DeploymentTimeout = TimeSpan.Parse(v));
            options.Add("cancelontimeout", "[Optional] Whether to cancel the deployment if the deployment timeout is reached (flag, default false).", v => CancelOnTimeout = true);
            options.Add("deploymentchecksleepcycle=", "[Optional] Specifies how much time (timespan format) should elapse between deployment status checks (default 00:00:10)", v => DeploymentStatusCheckSleepCycle = TimeSpan.Parse(v));
            options.Add("guidedfailure=", "[Optional] Whether to use Guided Failure mode. (True or False. If not specified, will use default setting from environment)", v => UseGuidedFailure = bool.Parse(v));
            options.Add("specificmachines=", "[Optional] A comma-separated list of machines names to target in the deployed environment. If not specified all machines in the environment will be considered.", v => SpecificMachineNames.AddRange(v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(m => m.Trim())));
            options.Add("force", "[Optional] If a project is configured to skip packages with already-installed versions, override this setting to force re-deployment (flag, default false).", v => ForcePackageRedeployment = true);
            options.Add("skip=", "[Optional] Skip a step by name", v => SkipStepNames.Add(v));
            options.Add("norawlog", "[Optional] Don't print the raw log of failed tasks", v => noRawLog = true);
            options.Add("rawlogfile=", "[Optional] Redirect the raw log of failed tasks to a file", v => rawLogFile = v);
            options.Add("v|variable=", "[Optional] Values for any prompted variables in the format Label:Value", ParseVariable);
            options.Add("deployat=", "[Optional] Time at which deployment should start (scheduled deployment), specified as any valid DateTimeOffset format, and assuming the time zone is the current local time zone.", v => ParseDeployAt(v));
            options.Add("tenant=", "A tenant the deployment will be performed for; specify this argument multiple times to add multiple tenants or use `*` wildcard to deploy to tenants able to deploy.", t => Tenants.Add(t));
            options.Add("tenanttag=", "A tenant tag used to match tenants that the deployment will be performed for; specify this argument multiple times to add multiple tenant tags", tt => TenantTags.Add(tt));
        }
コード例 #9
0
 public ListLatestDeploymentsCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Listing");
     options.Add("project=", "Name of a project to filter by. Can be specified many times.", v => projects.Add(v));
     options.Add("environment=", "Name of an environment to filter by. Can be specified many times.", v => environments.Add(v));
 }
コード例 #10
0
ファイル: PushCommand.cs プロジェクト: OctopusDeploy/Octo.exe
 public PushCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Package pushing");
     options.Add("package=", "Package file to push. Specify multiple packages by specifying this argument multiple times: \n--package package1 --package package2", package => Packages.Add(EnsurePackageExists(fileSystem, package)));
     options.Add("replace-existing", "If the package already exists in the repository, the default behavior is to reject the new package being pushed. You can pass this flag to overwrite the existing package.", replace => ReplaceExisting = true);
 }
コード例 #11
0
        public AllowReleaseProgressionCommand(IOctopusClientFactory clientFactory, IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, ICommandOutputProvider commandOutputProvider)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            var options = Options.For("Allowing release progression");

            options.Add <string>("project=", "Name or ID of the project.", v => ProjectNameOrId = v);
            options.Add <string>("version=|releaseNumber=", "Release version/number.", v => ReleaseVersionNumber = v);
        }
コード例 #12
0
        public ElasticEnvironmentSampleCommand(IOctopusClientFactory octopusClientFactory)
            : base(octopusClientFactory)
        {
            var options = Options.For("elastic sample");

            options.Add("projects=", $"[Optional] Number of projects to create, default {DefaultNumberOfProjects}", v => NumberOfProjects = int.Parse(v));
            options.Add("environments=", $"[Optional] Number of environments to create, default {DefaultNumberOfEnvironments}", v => NumberOfEnvironments = int.Parse(v));
        }
コード例 #13
0
        public MultiTenantSampleCommand(IOctopusClientFactory octopusClientFactory)
            : base(octopusClientFactory)
        {
            var options = Options.For("Multi-tenant sample");

            options.Add("projects=", $"[Optional] Number of projects to create, default {DefaultNumberOfProjects}", v => NumberOfProjects            = int.Parse(v));
            options.Add("customers=", $"[Optional] Number of customer tenants to create, default {DefaultNumberOfCustomers}", v => NumberOfCustomers = int.Parse(v));
            options.Add("testers=", $"[Optional] Number of test tenants to create, default {DefaultNumberOfTesters}", v => NumberOfTesters           = int.Parse(v));
        }
コード例 #14
0
        public PreventReleaseProgressionCommand(IOctopusClientFactory clientFactory, IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, ICommandOutputProvider commandOutputProvider)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            var options = Options.For("Preventing release progression.");

            options.Add <string>("project=", "Name or ID of the project", v => ProjectNameOrId = v);
            options.Add <string>("version=|releaseNumber=", "Release version/number", v => ReleaseVersionNumber = v);
            options.Add <string>("reason=", "Reason to prevent this release from progressing to next phase", v => ReasonToPrevent = v);
        }
コード例 #15
0
 public CreateProjectCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Project creation");
     options.Add("name=", "The name of the project", v => ProjectName = v);
     options.Add("projectGroup=", "The name of the project group to add this project to. If the group doesn't exist, it will be created.", v => ProjectGroupName = v);
     options.Add("lifecycle=", "The name of the lifecycle that the project will use.", v=> LifecycleName = v);
     options.Add("ignoreIfExists", "If the project already exists, an error will be returned. Set this flag to ignore the error.", v => IgnoreIfExists = true);
 }
コード例 #16
0
        public AzureCloudServiceSampleCommand(IOctopusClientFactory octopusClientFactory)
            : base(octopusClientFactory)
        {
            var options = Options.For("Azure Cloud Service sample");

            options.Add("subscription=", $"The Azure Subscription Id to use for this project, default {DefaultSubscriptionId}", v => subscriptionId = Guid.Parse(v));
            options.Add("storage=", $"The name of the Azure Storage Account to use for this project, default {DefaultStorageAccountName}", v => storageAccountName = v);
            options.Add("location=", $"The Azure Location to use for this project, default {DefaultLocation}", v => location = v);
        }
コード例 #17
0
 public PromoteReleaseCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(repositoryFactory, log, fileSystem, clientFactory)
 {
     var options = Options.For("Release Promotion");
     options.Add("project=", "Name of the project", v => ProjectName = v);
     options.Add("from=", "Name of the environment to get the current deployment from, e.g., Staging", v => FromEnvironmentName = v);
     options.Add("to=|deployto=", "Environment to deploy to, e.g., Production", v => DeployToEnvironmentNames.Add(v));
     options.Add("updateVariables", "Overwrite the variable snapshot for the release by re-importing the variables from the project", v => UpdateVariableSnapshot = true);
 }
コード例 #18
0
 public CreateChannelCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory) : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Create");
     options.Add("project=", "The name of the project in which to create the channel", p => projectName = p);
     options.Add("channel=", "The name of the channel to create", s => channelName = s);
     options.Add("description=", "[Optional] A description of the channel", d => channelDescription = d);
     options.Add("lifecycle=", "[Optional] if specified, the name of the lifecycle to use for promoting releases through this channel, otherwise this channel will inherit the project lifecycle", l => lifecycleName = l);
     options.Add("make-default-channel", "[Optional, Flag] if specified, set the new channel to be the default channel replacing any existing default channel", _ => makeDefaultChannel = true);
     options.Add("update-existing", "[Optional, Flag] if specified, updates the matching channel if it already exists, otherwise this command will fail if a matching channel already exists", _ => updateExisting = true);
 }
コード例 #19
0
 public DeleteReleasesCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Deletion");
     options.Add("project=", "Name of the project", v => ProjectName = v);
     options.Add("minversion=", "Minimum (inclusive) version number for the range of versions to delete", v => MinVersion = v);
     options.Add("maxversion=", "Maximum (inclusive) version number for the range of versions to delete", v => MaxVersion = v);
     options.Add("channel=", "[Optional] if specified, only releases associated with the channel will be deleted; specify this argument multiple times to target multiple channels.", v => ChannelNames.Add(v));
     options.Add("whatif", "[Optional, Flag] if specified, releases won't actually be deleted, but will be listed as if simulating the command", v => WhatIf = true);
 }
コード例 #20
0
        public ListDeploymentsCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log,
                                      IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            var options = Options.For("Listing");

            options.Add("project=", "[Optional] Name of a project to filter by. Can be specified many times.", v => projects.Add(v));
            options.Add("environment=", "[Optional] Name of an environment to filter by. Can be specified many times.", v => environments.Add(v));
            options.Add("tenant=", "[Optional] Name of a tenant to filter by. Can be specified many times.", v => tenants.Add(v));
            options.Add("number=", $"[Optional] number of results to return, default is {DefaultReturnAmount}", v => numberOfResults = int.Parse(v));
        }
コード例 #21
0
        public ImportCommand(IImporterLocator importerLocator, IOctopusFileSystem fileSystem, IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            this.importerLocator = importerLocator;

            var options = Options.For("Import");
            options.Add("type=", "The Octopus object type to import", v => Type = v);
            options.Add("filePath=", "The full path and name of the exported file", v => FilePath = v);
            options.Add("project=", "[Optional] The name of the project", v => Project = v);
            options.Add("dryRun", "[Optional] Perform a dry run of the import", v => DryRun = true);
        }
コード例 #22
0
 public CleanEnvironmentCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Cleanup");
     options.Add("environment=", "Name of an environment to clean up.", v => environmentName = v);
     options.Add("status=", $"Status of Machines clean up ({string.Join(", ", HealthStatusProvider.StatusNames)}). Can be specified many times.", v => statuses.Add(v));
     options.Add("health-status=|healthstatus=", $"Health status of Machines to clean up ({string.Join(", ", HealthStatusProvider.HealthStatusNames)}). Can be specified many times.", v => healthStatuses.Add(v));
     options.Add("disabled=", "[Optional] Disabled status filter of Machine to clean up.", v => SetFlagState(v, ref isDisabled));
     options.Add("calamari-outdated=", "[Optional] State of Calamari to clean up. By default ignores Calamari state.", v => SetFlagState(v, ref isCalamariOutdated));
     options.Add("tentacle-outdated=", "[Optional] State of Tentacle version to clean up. By default ignores Tentacle state", v => SetFlagState(v, ref isTentacleOutdated));
 }
コード例 #23
0
ファイル: ApiCommand.cs プロジェクト: archow/Sampler
        protected ApiCommand(IOctopusClientFactory octopusClientFactory)
        {
            this.octopusClientFactory = octopusClientFactory;

            var options = optionGroups.For("Common options");

            options.Add("server=", "The base URL for your Octopus server - e.g., http://your-octopus/", v => serverBaseUrl = v);
            options.Add("apiKey=", "Your API key. Get this from the user profile page.", v => apiKey = v);
            options.Add("user="******"[Optional] Username to use when authenticating with the server.", v => username = v);
            options.Add("pass="******"[Optional] Password to use when authenticating with the server.", v => password = v);
            options.Add("ignoreSslErrors", "[Optional] Set this flag if your Octopus server uses HTTPS but the certificate is not trusted on this machine. Any certificate errors will be ignored. WARNING: this option may create a security vulnerability.", v => ignoreSslErrors = true);
        }
コード例 #24
0
        public ExportCommand(IExporterLocator exporterLocator, IOctopusFileSystem fileSystem, IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            this.exporterLocator = exporterLocator;

            var options = Options.For("Export");
            options.Add("type=", "The type to export", v => Type = v);
            options.Add("filePath=", "The full path and name of the export file", v => FilePath = v);
            options.Add("project=", "[Optional] Name of the project", v => Project = v);
            options.Add("name=", "[Optional] Name of the item to export", v => Name = v);
            options.Add("releaseVersion=", "[Optional] The version number, or range of version numbers to export", v => ReleaseVersion = v);
        }
コード例 #25
0
        public DeployReleaseCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
            : base(repositoryFactory, log, fileSystem, clientFactory)
        {

            DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
            DeploymentTimeout = TimeSpan.FromMinutes(10);

            var options = Options.For("Deployment");
            options.Add("project=", "Name of the project", v => ProjectName = v);
            options.Add("deployto=", "Environment to deploy to, e.g., Production", v => DeployToEnvironmentNames.Add(v));
            options.Add("releaseNumber=|version=", "Version number of the release to deploy. Or specify --version=latest for the latest release.", v => VersionNumber = v);
            options.Add("channel=", "[Optional] Channel to use when getting the release to deploy", v => ChannelName = v);
            options.Add("updateVariables", "Overwrite the variable snapshot for the release by re-importing the variables from the project", v => UpdateVariableSnapshot = true);
        }
コード例 #26
0
        public void SetUp()
        {
            clientFactory = Substitute.For <IOctopusClientFactory>();
            client        = Substitute.For <IOctopusAsyncClient>();
            clientFactory.CreateAsyncClient(Arg.Any <OctopusServerEndpoint>()).Returns(client);
            operation      = new RegisterMachineOperation(clientFactory);
            serverEndpoint = new OctopusServerEndpoint("http://octopus", "ABC123");

            environments    = new ResourceCollection <EnvironmentResource>(new EnvironmentResource[0], LinkCollection.Self("/foo"));
            machines        = new ResourceCollection <MachineResource>(new MachineResource[0], LinkCollection.Self("/foo"));
            machinePolicies = new ResourceCollection <MachinePolicyResource>(new MachinePolicyResource[0], LinkCollection.Self("/foo"));
            var rootDocument = new RootResource
            {
                ApiVersion = "3.0.0",
                Version    = "2099.0.0",
                Links      = LinkCollection.Self("/api")
                             .Add("Environments", "/api/environments")
                             .Add("Machines", "/api/machines")
                             .Add("MachinePolicies", "/api/machinepolicies")
                             .Add("CurrentUser", "/api/users/me")
                             .Add("SpaceHome", "/api/spaces")
            };

            client.Get <RootResource>(Arg.Any <string>()).Returns(rootDocument);
            client.Repository.LoadRootDocument().Returns(rootDocument);
            client.Get <SpaceResource[]>(Arg.Any <string>())
            .Returns(new[] { new SpaceResource()
                             {
                                 Id = "Spaces-1", IsDefault = true
                             } });
            client.Get <UserResource>(Arg.Any <string>()).Returns(new UserResource()
            {
                Links =
                {
                    { "Spaces", "" }
                }
            });
            client.Repository.HasLink(Arg.Any <string>()).Returns(ci => rootDocument.HasLink(ci.Arg <string>()));
            client.Repository.Link(Arg.Any <string>()).Returns(ci => rootDocument.Link(ci.Arg <string>()));

            client.When(x => x.Paginate(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <Func <ResourceCollection <EnvironmentResource>, bool> >()))
            .Do(ci => ci.Arg <Func <ResourceCollection <EnvironmentResource>, bool> >()(environments));
            client.When(x => x.Paginate(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <Func <ResourceCollection <MachineResource>, bool> >()))
            .Do(ci => ci.Arg <Func <ResourceCollection <MachineResource>, bool> >()(machines));
            client.When(x => x.Paginate(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <Func <ResourceCollection <MachinePolicyResource>, bool> >()))
            .Do(ci => ci.Arg <Func <ResourceCollection <MachinePolicyResource>, bool> >()(machinePolicies));

            client.List <MachineResource>(Arg.Any <string>(), Arg.Any <object>()).Returns(machines);
        }
コード例 #27
0
 public DeleteAutoDeployOverrideCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory octopusClientFactory) :
     base(octopusClientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Delete auto deploy release override");
     options.Add("project=", "Name of the project", v => ProjectName = v);
     options.Add("environment=",
         "Name of an environment the override will apply to. Specify this argument multiple times to add multiple environments.",
         v => EnvironmentNames.Add(v));
     options.Add("tenant=",
         "[Optional] Name of a tenant the override will apply to. Specify this argument multiple times to add multiple tenants or use `*` wildcard for all tenants.",
         t => TenantNames.Add(t));
     options.Add("tenanttag=",
         "[Optional] A tenant tag used to match tenants that the override will apply to. Specify this argument multiple times to add multiple tenant tags",
         tt => TenantTags.Add(tt));
 }
コード例 #28
0
        public ImportCommand(IImporterLocator importerLocator,
            IOctopusFileSystem fileSystem,
            IOctopusAsyncRepositoryFactory repositoryFactory,
            ILogger log,
            IOctopusClientFactory clientFactory,
            ICommandOutputProvider commandOutputProvider)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            this.importerLocator = importerLocator;

            var options = Options.For("Import");
            options.Add<string>("type=", "The Octopus object type to import.", v => Type = v);
            options.Add<string>("filePath=", "The full path and name of the exported file.", v => FilePath = v);
            options.Add<string>("project=", "[Optional] The name of the project.", v => Project = v);
            options.Add<bool>("dryRun", "[Optional] Perform a dry run of the import.", v => DryRun = true);
        }
コード例 #29
0
ファイル: ApiCommand.cs プロジェクト: OctopusDeploy/Octo.exe
        protected ApiCommand(IOctopusClientFactory clientFactory, IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
        {
            this.clientFactory = clientFactory;
            this.repositoryFactory = repositoryFactory;
            this.Log = log;
            this.FileSystem = fileSystem;

            var options = Options.For("Common options");
            options.Add("server=", "The base URL for your Octopus server - e.g., http://your-octopus/", v => ServerBaseUrl = v);
            options.Add("apiKey=", "Your API key. Get this from the user profile page.", v => apiKey = v);
            options.Add("user="******"[Optional] Username to use when authenticating with the server.", v => username = v);
            options.Add("pass="******"[Optional] Password to use when authenticating with the server.", v => password = v);
            options.Add("configFile=", "[Optional] Text file of default values, with one 'key = value' per line.", v => ReadAdditionalInputsFromConfigurationFile(v));
            options.Add("debug", "[Optional] Enable debug logging", v => enableDebugging = true);
            options.Add("ignoreSslErrors", "[Optional] Set this flag if your Octopus server uses HTTPS but the certificate is not trusted on this machine. Any certificate errors will be ignored. WARNING: this option may create a security vulnerability.", v => ignoreSslErrors = true);
            options.Add("enableServiceMessages", "[Optional] Enable TeamCity or Team Foundation Build service messages when logging.", v => log.EnableServiceMessages());
        }
コード例 #30
0
        protected DeploymentCommandBase(
            IOctopusAsyncRepositoryFactory repositoryFactory,
            IOctopusFileSystem fileSystem,
            IOctopusClientFactory clientFactory,
            ICommandOutputProvider commandOutputProvider,
            ExecutionResourceWaiter.Factory executionResourceWaiterFactory)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            this.executionResourceWaiterFactory = executionResourceWaiterFactory;
            SpecificMachineNames          = new List <string>();
            ExcludedMachineNames          = new List <string>();
            SkipStepNames                 = new List <string>();
            DeployToEnvironmentNamesOrIds = new List <string>();
            TenantTags       = new List <string>();
            Tenants          = new List <string>();
            promotionTargets = new List <DeploymentPromotionTarget>();

            var options = Options.For("Deployment");

            options.Add <bool>("progress",
                               "[Optional] Show progress of the deployment.",
                               v =>
            {
                showProgress      = true;
                WaitForDeployment = true;
                noRawLog          = true;
            });
            options.Add <bool>("forcePackageDownload", "[Optional] Whether to force downloading of already installed packages (flag, default false).", v => ForcePackageDownload = true);
            options.Add <bool>("waitForDeployment", "[Optional] Whether to wait synchronously for deployment to finish.", v => WaitForDeployment = true);
            options.Add <TimeSpan>("deploymentTimeout=", "[Optional] Specifies maximum time (timespan format) that the console session will wait for the deployment to finish(default 00:10:00). This will not stop the deployment. Requires --waitForDeployment parameter set.", v => DeploymentTimeout = v);
            options.Add <bool>("cancelOnTimeout", "[Optional] Whether to cancel the deployment if the deployment timeout is reached (flag, default false).", v => CancelOnTimeout = true);
            options.Add <TimeSpan>("deploymentCheckSleepCycle=", "[Optional] Specifies how much time (timespan format) should elapse between deployment status checks (default 00:00:10).", v => DeploymentStatusCheckSleepCycle = v);
            options.Add <bool>("guidedFailure=", "[Optional] Whether to use guided failure mode. (True or False. If not specified, will use default setting from environment).", v => UseGuidedFailure = v);
            options.Add <string>("specificMachines=", "[Optional] A comma-separated list of machine names to target in the deployed environment. If not specified all machines in the environment will be considered.", v => SpecificMachineNames.AddRange(v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(m => m.Trim())), allowsMultiple: true);
            options.Add <string>("excludeMachines=", "[Optional] A comma-separated list of machine names to exclude in the deployed environment. If not specified all machines in the environment will be considered.", v => ExcludedMachineNames.AddRange(v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(m => m.Trim())), allowsMultiple: true);
            options.Add <bool>("force", "[Optional] If a project is configured to skip packages with already-installed versions, override this setting to force re-deployment (flag, default false).", v => ForcePackageRedeployment = true);
            options.Add <string>("skip=", "[Optional] Skip a step by name.", v => SkipStepNames.Add(v), allowsMultiple: true);
            options.Add <bool>("noRawLog", "[Optional] Don't print the raw log of failed tasks.", v => noRawLog = true);
            options.Add <string>("rawLogFile=", "[Optional] Redirect the raw log of failed tasks to a file.", v => rawLogFile = v);
            options.Add <string>("v|variable=", "[Optional] Specifies the value for a prompted variable in the format Label:Value. For JSON values, embedded quotation marks should be escaped with a backslash.", ParseVariable, allowsMultiple: true);
            options.Add <DateTimeOffset>("deployAt=", "[Optional] Time at which deployment should start (scheduled deployment), specified as any valid DateTimeOffset format, and assuming the time zone is the current local time zone.", v => DeployAt = v);
            options.Add <DateTimeOffset>("noDeployAfter=", "[Optional] Time at which scheduled deployment should expire, specified as any valid DateTimeOffset format, and assuming the time zone is the current local time zone.", v => NoDeployAfter   = v);
            options.Add <string>("tenant=", "[Optional] Create a deployment for the tenant with this name or ID; specify this argument multiple times to add multiple tenants or use `*` wildcard to deploy to all tenants who are ready for this release (according to lifecycle).", t => Tenants.Add(t), allowsMultiple: true);
            options.Add <string>("tenantTag=", "[Optional] Create a deployment for tenants matching this tag; specify this argument multiple times to build a query/filter with multiple tags, just like you can in the user interface.", tt => TenantTags.Add(tt), allowsMultiple: true);
        }
コード例 #31
0
        public ExportCommand(IExporterLocator exporterLocator,
                             IOctopusFileSystem fileSystem,
                             IOctopusAsyncRepositoryFactory repositoryFactory,
                             ILogger log,
                             IOctopusClientFactory clientFactory,
                             ICommandOutputProvider commandOutputProvider)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            this.exporterLocator = exporterLocator;

            var options = Options.For("Export");

            options.Add <string>("type=", "The type to export.", v => Type = v);
            options.Add <string>("filePath=", "The full path and name of the export file.", v => FilePath = v);
            options.Add <string>("project=", "[Optional] Name of the project.", v => Project  = v);
            options.Add <string>("name=", "[Optional] Name of the item to export.", v => Name = v);
            options.Add <string>("releaseVersion=", "[Optional] The version number, or range of version numbers to export.", v => ReleaseVersion = v);
        }
コード例 #32
0
        public DeployReleaseCommand(IOctopusAsyncRepositoryFactory repositoryFactory,
                                    IOctopusFileSystem fileSystem,
                                    IOctopusClientFactory clientFactory,
                                    ICommandOutputProvider commandOutputProvider,
                                    ExecutionResourceWaiter.Factory executionResourceWaiterFactory)
            : base(repositoryFactory,
                   fileSystem,
                   clientFactory,
                   commandOutputProvider,
                   executionResourceWaiterFactory)
        {
            var options = Options.For("Deployment");

            options.Add <string>("project=", "Name or ID of the project.", v => ProjectNameOrId = v);
            options.Add <string>("deployTo=", "Name or ID of the environment to deploy to, e.g., 'Production' or 'Environments-1'; specify this argument multiple times to deploy to multiple environments.", v => DeployToEnvironmentNamesOrIds.Add(v), allowsMultiple: true);
            options.Add <string>("releaseNumber=|version=", "Version number of the release to deploy. Or specify --version=latest for the latest release.", v => VersionNumber = v);
            options.Add <string>("channel=", "[Optional] Name or ID of the channel to use when getting the release to deploy.", v => ChannelNameOrId = v);
            options.Add <bool>("updateVariables", "Overwrite the variable snapshot for the release by re-importing the variables from the project.", v => UpdateVariableSnapshot = true);
        }
コード例 #33
0
        public PromoteReleaseCommand(IOctopusAsyncRepositoryFactory repositoryFactory,
                                     IOctopusFileSystem fileSystem,
                                     IOctopusClientFactory clientFactory,
                                     ICommandOutputProvider commandOutputProvider,
                                     ExecutionResourceWaiter.Factory executionResourceWaiterFactory)
            : base(repositoryFactory,
                   fileSystem,
                   clientFactory,
                   commandOutputProvider,
                   executionResourceWaiterFactory)
        {
            var options = Options.For("Release Promotion");

            options.Add <string>("project=", "Name or ID of the project.", v => ProjectNameOrId = v);
            options.Add <string>("from=", "Name or ID of the environment to get the current deployment from, e.g., 'Staging' or 'Environments-2'.", v => FromEnvironmentNameOrId = v);
            options.Add <string>("to=|deployTo=", "Name or ID of the environment to deploy to, e.g., 'Production' or 'Environments-1'.", v => DeployToEnvironmentNamesOrIds.Add(v), allowsMultiple: true);
            options.Add <bool>("updateVariables", "Overwrite the variable snapshot for the release by re-importing the variables from the project.", v => UpdateVariableSnapshot = true);
            options.Add <bool>("latestSuccessful", "Use the latest successful release to promote.", v => UseLatestSuccessfulRelease = true);
        }
コード例 #34
0
        public void SetUp()
        {
            clientFactory = Substitute.For<IOctopusClientFactory>();
            client = Substitute.For<IOctopusAsyncClient>();
            clientFactory.CreateAsyncClient(Arg.Any<OctopusServerEndpoint>()).Returns(client);
            operation = new RegisterMachineOperation(clientFactory);
            serverEndpoint = new OctopusServerEndpoint("http://octopus", "ABC123");

            environments = new ResourceCollection<EnvironmentResource>(new EnvironmentResource[0], LinkCollection.Self("/foo"));
            machines = new ResourceCollection<MachineResource>(new MachineResource[0], LinkCollection.Self("/foo"));
            client.RootDocument.Returns(new RootResource {Links = LinkCollection.Self("/api").Add("Environments", "/api/environments").Add("Machines", "/api/machines")});

            client.When(x => x.Paginate(Arg.Any<string>(), Arg.Any<object>(), Arg.Any<Func<ResourceCollection<EnvironmentResource>, bool>>()))
                .Do(ci => ci.Arg<Func<ResourceCollection<EnvironmentResource>, bool>>()(environments));

            client.When(x => x.Paginate(Arg.Any<string>(), Arg.Any<object>(), Arg.Any<Func<ResourceCollection<MachineResource>, bool>>()))
                .Do(ci => ci.Arg<Func<ResourceCollection<MachineResource>, bool>>()(machines));

            client.List<MachineResource>(Arg.Any<string>(), Arg.Any<object>()).Returns(machines);
        }
コード例 #35
0
        protected ApiCommand(IOctopusClientFactory clientFactory, IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
        {
            this.clientFactory     = clientFactory;
            this.repositoryFactory = repositoryFactory;
            this.Log        = log;
            this.FileSystem = fileSystem;

            var options = Options.For("Common options");

            options.Add("server=", "The base URL for your Octopus server - e.g., http://your-octopus/", v => ServerBaseUrl = v);
            options.Add("apiKey=", "Your API key. Get this from the user profile page.", v => apiKey = v);
            options.Add("user="******"[Optional] Username to use when authenticating with the server.", v => username = v);
            options.Add("pass="******"[Optional] Password to use when authenticating with the server.", v => password = v);
            options.Add("configFile=", "[Optional] Text file of default values, with one 'key = value' per line.", v => ReadAdditionalInputsFromConfigurationFile(v));
            options.Add("debug", "[Optional] Enable debug logging", v => enableDebugging = true);
#if HTTP_CLIENT_SUPPORTS_SSL_OPTIONS
            options.Add("ignoreSslErrors", "[Optional] Set this flag if your Octopus server uses HTTPS but the certificate is not trusted on this machine. Any certificate errors will be ignored. WARNING: this option may create a security vulnerability.", v => ignoreSslErrors = true);
#endif
            options.Add("enableServiceMessages", "[Optional] Enable TeamCity or Team Foundation Build service messages when logging.", v => log.EnableServiceMessages());
        }
コード例 #36
0
        public CreateReleaseCommand(IOctopusAsyncRepositoryFactory repositoryFactory,
                                    IOctopusFileSystem fileSystem,
                                    IPackageVersionResolver versionResolver,
                                    IReleasePlanBuilder releasePlanBuilder,
                                    IOctopusClientFactory clientFactory,
                                    ICommandOutputProvider commandOutputProvider,
                                    ExecutionResourceWaiter.Factory executionResourceWaiterFactory)
            : base(repositoryFactory,
                   fileSystem,
                   clientFactory,
                   commandOutputProvider,
                   executionResourceWaiterFactory)
        {
            this.releasePlanBuilder = releasePlanBuilder;

            var options = Options.For("Release creation");

            options.Add <string>("project=", "Name or ID of the project.", v => ProjectNameOrId = v);
            options.Add <string>("defaultPackageVersion=|packageVersion=", "Default version number of all packages to use for this release. Override per-package using --package.", versionResolver.Default);
            options.Add <string>("ref=|gitRef=", "[Optional, Experimental] Git reference to use when creating the release.", v => GitReference = v);
            options.Add <string>("version=|releaseNumber=", "[Optional] Release number to use for the new release.", v => VersionNumber        = v);
            options.Add <string>("channel=", "[Optional] Name or ID of the channel to use for the new release. Omit this argument to automatically select the best channel.", v => ChannelNameOrId = v);
            options.Add <string>("package=", "[Optional] Version number to use for a package in the release. Format: StepName:Version or PackageID:Version or StepName:PackageName:Version. StepName, PackageID, and PackageName can be replaced with an asterisk. An asterisk will be assumed for StepName, PackageID, or PackageName if they are omitted.", v => versionResolver.Add(v), allowsMultiple: true);
            options.Add <string>("packagesFolder=",
                                 "[Optional] A folder containing NuGet packages from which we should get versions.",
                                 v =>
            {
                v.CheckForIllegalPathCharacters("packagesFolder");
                versionResolver.AddFolder(v);
            },
                                 allowsMultiple: true);
            options.Add <string>("releaseNotes=", "[Optional] Release Notes for the new release. Styling with Markdown is supported.", v => ReleaseNotes = v);
            options.Add <string>("releaseNoteFile=|releaseNotesFile=", "[Optional] Path to a file that contains Release Notes for the new release. Supports Markdown files.", ReadReleaseNotesFromFile);
            options.Add <bool>("ignoreExisting", "[Optional, Flag] Don't create this release if there is already one with the same version number.", v => IgnoreIfAlreadyExists = true);
            options.Add <bool>("ignoreChannelRules", "[Optional, Flag] Create the release ignoring any version rules specified by the channel.", v => IgnoreChannelRules        = true);
            options.Add <string>("packagePrerelease=", "[Optional] Pre-release for latest version of all packages to use for this release.", v => VersionPreReleaseTag          = v);
            options.Add <bool>("whatIf", "[Optional, Flag] Perform a dry run but don't actually create/deploy release.", v => WhatIf = true);

            options = Options.For("Deployment");
            options.Add <string>("deployTo=", "[Optional] Name or ID of the environment to automatically deploy to, e.g., 'Production' or 'Environments-1'; specify this argument multiple times to deploy to multiple environments.", v => DeployToEnvironmentNamesOrIds.Add(v), allowsMultiple: true);
        }
コード例 #37
0
        protected ApiCommand(IOctopusClientFactory clientFactory, IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
        {
            this.clientFactory     = clientFactory;
            this.repositoryFactory = repositoryFactory;
            this.Log        = log;
            this.FileSystem = fileSystem;

            var options = Options.For("Common options");

            options.Add("server=", "The base URL for your Octopus server - e.g., http://your-octopus/", v => ServerBaseUrl = v);
            options.Add("apiKey=", "[Optional] Your API key. Get this from the user profile page. Your must provide an apiKey or username and password. If the guest account is enabled, a key of API-GUEST can be used.", v => apiKey = v);
            options.Add("user="******"[Optional] Username to use when authenticating with the server. Your must provide an apiKey or username and password.", v => username = v);
            options.Add("pass="******"[Optional] Password to use when authenticating with the server.", v => password = v);
            options.Add("configFile=", "[Optional] Text file of default values, with one 'key = value' per line.", v => ReadAdditionalInputsFromConfigurationFile(v));
            options.Add("debug", "[Optional] Enable debug logging", v => enableDebugging = true);
            options.Add("ignoreSslErrors", "[Optional] Set this flag if your Octopus server uses HTTPS but the certificate is not trusted on this machine. Any certificate errors will be ignored. WARNING: this option may create a security vulnerability.", v => ignoreSslErrors = true);
            options.Add("enableServiceMessages", "[Optional] Enable TeamCity or Team Foundation Build service messages when logging.", v => log.EnableServiceMessages());
            options.Add("timeout=", $"[Optional] Timeout in seconds for network operations. Default is {ApiConstants.DefaultClientRequestTimeout/1000}.", v => clientOptions.Timeout = TimeSpan.FromSeconds(int.Parse(v)));
            options.Add("proxy=", $"[Optional] The URI of the proxy to use, eg http://example.com:8080.", v => clientOptions.Proxy = v);
            options.Add("proxyUser="******"[Optional] The username for the proxy.", v => clientOptions.ProxyUsername = v);
            options.Add("proxyPass="******"[Optional] The password for the proxy. If both the username and password are omitted and proxyAddress is specified, the default credentials are used. ", v => clientOptions.ProxyPassword = v);
        }
コード例 #38
0
        public void SetUp()
        {
            clientFactory = Substitute.For <IOctopusClientFactory>();
            client        = Substitute.For <IOctopusAsyncClient>();
            clientFactory.CreateAsyncClient(Arg.Any <OctopusServerEndpoint>()).Returns(client);
            operation      = new RegisterMachineOperation(clientFactory);
            serverEndpoint = new OctopusServerEndpoint("http://octopus", "ABC123");

            environments = new ResourceCollection <EnvironmentResource>(new EnvironmentResource[0], LinkCollection.Self("/foo"));
            machines     = new ResourceCollection <MachineResource>(new MachineResource[0], LinkCollection.Self("/foo"));
            client.RootDocument.Returns(new RootResource {
                Links = LinkCollection.Self("/api").Add("Environments", "/api/environments").Add("Machines", "/api/machines")
            });

            client.When(x => x.Paginate(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <Func <ResourceCollection <EnvironmentResource>, bool> >()))
            .Do(ci => ci.Arg <Func <ResourceCollection <EnvironmentResource>, bool> >()(environments));

            client.When(x => x.Paginate(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <Func <ResourceCollection <MachineResource>, bool> >()))
            .Do(ci => ci.Arg <Func <ResourceCollection <MachineResource>, bool> >()(machines));

            client.List <MachineResource>(Arg.Any <string>(), Arg.Any <object>()).Returns(machines);
        }
コード例 #39
0
        public CreateReleaseCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IPackageVersionResolver versionResolver, IReleasePlanBuilder releasePlanBuilder, IOctopusClientFactory clientFactory)
            : base(repositoryFactory, log, fileSystem, clientFactory)
        {
            this.releasePlanBuilder = releasePlanBuilder;
            DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
            DeploymentTimeout = TimeSpan.FromMinutes(10);

            var options = Options.For("Release creation");
            options.Add("project=", "Name of the project", v => ProjectName = v);
            options.Add("defaultpackageversion=|packageversion=", "Default version number of all packages to use for this release. Override per-package using --package.", versionResolver.Default);
            options.Add("version=|releaseNumber=", "[Optional] Release number to use for the new release.", v => VersionNumber = v);
            options.Add("channel=", "[Optional] Channel to use for the new release. Omit this argument to automatically select the best channel.", v => ChannelName = v);
            options.Add("package=", "[Optional] Version number to use for a package in the release. Format: --package={StepName}:{Version}", v => versionResolver.Add(v));
            options.Add("packagesFolder=", "[Optional] A folder containing NuGet packages from which we should get versions.", v => versionResolver.AddFolder(v));
            options.Add("releasenotes=", "[Optional] Release Notes for the new release.", v => ReleaseNotes = v);
            options.Add("releasenotesfile=", "[Optional] Path to a file that contains Release Notes for the new release.", ReadReleaseNotesFromFile);
            options.Add("ignoreexisting", "[Optional, Flag] Don't create this release if there is already one with the same version number.", v => IgnoreIfAlreadyExists = true);
            options.Add("ignorechannelrules", "[Optional, Flag] Create the release ignoring any version rules specified by the channel.", v => IgnoreChannelRules = true);
            options.Add("packageprerelease=", "[Optional] Pre-release for latest version of all packages to use for this release.", v => VersionPreReleaseTag = v);
            options.Add("whatif", "[Optional, Flag] Perform a dry run but don't actually create/deploy release.", v => WhatIf = true);

            options = Options.For("Deployment");
            options.Add("deployto=", "[Optional] Environment to automatically deploy to, e.g., Production", v => DeployToEnvironmentNames.Add(v));
        }
コード例 #40
0
 public ListProjectsCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
 }
コード例 #41
0
        public CleanEnvironmentCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            var options = Options.For("Cleanup");

            options.Add("environment=", "Name of an environment to clean up.", v => environmentName = v);
            options.Add("status=", $"Status of Machines clean up ({string.Join(", ", HealthStatusProvider.StatusNames)}). Can be specified many times.", v => statuses.Add(v));
            options.Add("health-status=|healthstatus=", $"Health status of Machines to clean up ({string.Join(", ", HealthStatusProvider.HealthStatusNames)}). Can be specified many times.", v => healthStatuses.Add(v));
            options.Add("disabled=", "[Optional] Disabled status filter of Machine to clean up.", v => SetFlagState(v, ref isDisabled));
            options.Add("calamari-outdated=", "[Optional] State of Calamari to clean up. By default ignores Calamari state.", v => SetFlagState(v, ref isCalamariOutdated));
            options.Add("tentacle-outdated=", "[Optional] State of Tentacle version to clean up. By default ignores Tentacle state", v => SetFlagState(v, ref isTentacleOutdated));
        }
コード例 #42
0
 public ListWorkerPoolsCommand(IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory, ICommandOutputProvider commandOutputProvider)
     : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
 {
 }
コード例 #43
0
        public CreateWorkerPoolCommand(IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory, ICommandOutputProvider commandOutputProvider)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            var options = Options.For("WorkerPool creation");

            options.Add("name=", "The name of the worker pool", v => WorkerPoolName = v);
            options.Add("ignoreIfExists", "If the pool already exists, an error will be returned. Set this flag to ignore the error.", v => IgnoreIfExists = true);
        }
コード例 #44
0
        public ListReleasesCommand(IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory, ICommandOutputProvider commandOutputProvider)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            var options = Options.For("Listing");

            options.Add <string>("project=", "Name of a project to filter by. Can be specified many times.", v => projects.Add(v), allowsMultiple: true);
        }
コード例 #45
0
 public CreateReleaseCommand(IOctopusClientFactory clientFactory, ILog log)
     : base(clientFactory, log)
 {
 }
コード例 #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RegisterMachineOperation" /> class.
 /// </summary>
 /// <param name="clientFactory">The client factory.</param>
 public RegisterMachineOperation(IOctopusClientFactory clientFactory)
 {
     this.clientFactory = clientFactory ?? new OctopusClientFactory();
 }
コード例 #47
0
        public CleanWorkerPoolCommand(IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory, ICommandOutputProvider commandOutputProvider)
            : base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            var options = Options.For("WorkerPool Cleanup");

            options.Add <string>("workerPool=", "Name of a worker pool to clean up.", v => poolName = v);
            options.Add <MachineModelHealthStatus>("health-status=", $"Health status of Workers to clean up. Valid values are {HealthStatusProvider.HealthStatusNames.ReadableJoin()}. Can be specified many times.", v => healthStatuses.Add(v), allowsMultiple: true);
            options.Add <bool>("disabled=", "[Optional] Disabled status filter of Worker to clean up.", v => isDisabled = v);
            options.Add <bool>("calamari-outdated=", "[Optional] State of Calamari to clean up. By default ignores Calamari state.", v => isCalamariOutdated         = v);
            options.Add <bool>("tentacle-outdated=", "[Optional] State of Tentacle version to clean up. By default ignores Tentacle state.", v => isTentacleOutdated = v);
        }
コード例 #48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RegisterMachineOperation" /> class.
 /// </summary>
 /// <param name="clientFactory">The client factory.</param>
 public RegisterMachineOperation(IOctopusClientFactory clientFactory) : base(clientFactory)
 {
 }
コード例 #49
0
 public ListEnvironmentsCommand(IOctopusClientFactory client, ILog log)
     : base(client, log)
 {
 }
コード例 #50
0
 public DumpDeploymentsCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
     : base(clientFactory, repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Dumper");
     options.Add("filePath=", "The full path and name of the export file", delegate(string v) { filePath = v; });
 }
コード例 #51
0
        protected DeploymentCommandBase(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            SpecificMachineNames     = new List <string>();
            SkipStepNames            = new List <string>();
            DeployToEnvironmentNames = new List <string>();
            TenantTags = new List <string>();
            Tenants    = new List <string>();

            var options = Options.For("Deployment");

            options.Add("progress", "[Optional] Show progress of the deployment", v => { showProgress = true; WaitForDeployment = true; noRawLog = true; });
            options.Add("forcepackagedownload", "[Optional] Whether to force downloading of already installed packages (flag, default false).", v => ForcePackageDownload = true);
            options.Add("waitfordeployment", "[Optional] Whether to wait synchronously for deployment to finish.", v => WaitForDeployment = true);
            options.Add("deploymenttimeout=", "[Optional] Specifies maximum time (timespan format) that the console session will wait for the deployment to finish(default 00:10:00). This will not stop the deployment. Requires --waitfordeployment parameter set.", v => DeploymentTimeout = TimeSpan.Parse(v));
            options.Add("cancelontimeout", "[Optional] Whether to cancel the deployment if the deployment timeout is reached (flag, default false).", v => CancelOnTimeout = true);
            options.Add("deploymentchecksleepcycle=", "[Optional] Specifies how much time (timespan format) should elapse between deployment status checks (default 00:00:10)", v => DeploymentStatusCheckSleepCycle = TimeSpan.Parse(v));
            options.Add("guidedfailure=", "[Optional] Whether to use Guided Failure mode. (True or False. If not specified, will use default setting from environment)", v => UseGuidedFailure = bool.Parse(v));
            options.Add("specificmachines=", "[Optional] A comma-separated list of machines names to target in the deployed environment. If not specified all machines in the environment will be considered.", v => SpecificMachineNames.AddRange(v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(m => m.Trim())));
            options.Add("force", "[Optional] If a project is configured to skip packages with already-installed versions, override this setting to force re-deployment (flag, default false).", v => ForcePackageRedeployment = true);
            options.Add("skip=", "[Optional] Skip a step by name", v => SkipStepNames.Add(v));
            options.Add("norawlog", "[Optional] Don't print the raw log of failed tasks", v => noRawLog             = true);
            options.Add("rawlogfile=", "[Optional] Redirect the raw log of failed tasks to a file", v => rawLogFile = v);
            options.Add("v|variable=", "[Optional] Values for any prompted variables in the format Label:Value", ParseVariable);
            options.Add("deployat=", "[Optional] Time at which deployment should start (scheduled deployment), specified as any valid DateTimeOffset format, and assuming the time zone is the current local time zone.", v => ParseDeployAt(v));
            options.Add("tenant=", "A tenant the deployment will be performed for; specify this argument multiple times to add multiple tenants or use `*` wildcard to deploy to tenants able to deploy.", t => Tenants.Add(t));
            options.Add("tenanttag=", "A tenant tag used to match tenants that the deployment will be performed for; specify this argument multiple times to add multiple tenant tags", tt => TenantTags.Add(tt));
        }
コード例 #52
0
        public DumpDeploymentsCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            var options = Options.For("Dumper");

            options.Add("filePath=", "The full path and name of the export file", delegate(string v) { filePath = v; });
        }
コード例 #53
0
        public ListReleasesCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory)
            : base(clientFactory, repositoryFactory, log, fileSystem)
        {
            var options = Options.For("Listing");

            options.Add("project=", "Name of a project to filter by. Can be specified many times.", v => projects.Add(v));
        }
コード例 #54
0
 public CreateReleaseCommand(IOctopusClientFactory clientFactory, ILog log)
     : base(clientFactory, log)
 {
     DeployToEnvironmentNames = new List<string>();
 }