Beispiel #1
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);
        }
        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);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public RunRunbookCommand(
            IOctopusAsyncRepositoryFactory repositoryFactory,
            IOctopusFileSystem fileSystem,
            IOctopusClientFactory clientFactory,
            ICommandOutputProvider commandOutputProvider,
            ExecutionResourceWaiter.Factory executionResourceWaiterFactory) : base(clientFactory,
                                                                                   repositoryFactory, fileSystem, commandOutputProvider)
        {
            this.executionResourceWaiterFactory = executionResourceWaiterFactory;
            var options = Options.For("Run Runbook");

            options.Add <string>("project=",
                                 "Name or ID of the project. This is optional if the runbook argument is an ID",
                                 v => ProjectNameOrId = v);

            options.Add <string>("runbook=",
                                 "Name or ID of the runbook. If the name is supplied, the project parameter must also be specified.",
                                 v => RunbookNameOrId = v);

            options.Add <string>("environment=",
                                 "Name or ID of the environment to run in, e.g ., 'Production' or 'Environments-1'; specify this argument multiple times to run in multiple environments.",
                                 v => EnvironmentNamesOrIds.Add(v),
                                 allowsMultiple: true);

            options.Add <string>("snapshot=",
                                 "[Optional] Name or ID of the snapshot to run. If not supplied, the command will attempt to use the published snapshot.",
                                 v => Snapshot = v);

            options.Add <bool>("forcePackageDownload",
                               "[Optional] Whether to force downloading of already installed packages (flag, default false).",
                               v => ForcePackageDownload = true);

            options.Add <bool>("guidedFailure=",
                               "[Optional] Whether to use Guided Failure mode. (True or False. If not specified, will use default setting from environment)",
                               v => GuidedFailure = v);

            options.Add <string>("specificMachines=",
                                 "[Optional] A comma-separated list of machine names to target in the specified environment/s. If not specified all machines in the environment will be considered.",
                                 v => IncludedMachineIds.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 specified environment/s. If not specified all machines in the environment will be considered.",
                                 v => ExcludedMachineIds.AddRange(v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                                                  .Select(m => m.Trim())),
                                 allowsMultiple: true);

            options.Add <string>("tenant=",
                                 "[Optional] Run a runbook on 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).",
                                 v => TenantNamesOrIds.Add(v),
                                 allowsMultiple: true);

            options.Add <string>("tenantTag=",
                                 "[Optional] Run a runbook on the 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.",
                                 v => TenantTagNames.Add(v),
                                 allowsMultiple: true);

            options.Add <string>("skip=",
                                 "[Optional] Skip a step by name",
                                 v => StepNamesToSkip.Add(v),
                                 allowsMultiple: true);

            options.Add <DateTimeOffset>("runAt=",
                                         "[Optional] Time at which runbook run should start (scheduled run), specified as any valid DateTimeOffset format, and assuming the time zone is the current local time zone.",
                                         v => RunAt = v);

            options.Add <DateTimeOffset>("noRunAfter=",
                                         "[Optional] Time at which scheduled runbook run should expire, specified as any valid DateTimeOffset format, and assuming the time zone is the current local time zone.",
                                         v => NoRunAfter = 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 <bool>("waitForRun", "[Optional] Whether to wait synchronously for deployment to finish.",
                               v => WaitForRun = true);

            options.Add <bool>("progress", "[Optional] Show progress of the runbook run", v =>
            {
                Progress   = true;
                WaitForRun = true;
                NoRawLog   = true;
            });

            options.Add <TimeSpan>("runTimeout=",
                                   "[Optional] Specifies maximum time (timespan format) that the console session will wait for the runbook run to finish (default 00:10:00). This will not stop the run. Requires --waitForRun parameter to be set.",
                                   v => RunTimeout = v);

            options.Add <bool>("cancelOnTimeout",
                               "[Optional] Whether to cancel the runbook run if the run timeout is reached (flag, default false).",
                               v => CancelOnTimeout = true);

            options.Add <TimeSpan>("runCheckSleepCycle=",
                                   "[Optional] Specifies how much time (timespan format) should elapse between runbook run status checks (default 00:00:10)",
                                   v => RunCheckSleepCycle = v);

            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);
        }