示例#1
0
        protected DeploymentCommandBase(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
            : base(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));
        }
 public ListMachinesCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(repositoryFactory, log, fileSystem)
 {
     var options = Options.For("Listing");
     options.Add("environment=", "Name of an environment to filter by. Can be specified many times.", v => environments.Add(v));
     options.Add("status=", string.Format("Status of Machines filter by ({0}). Can be specified many times.", string.Join(", ", StatusNames)), v => statuses.Add(v));
 }
示例#3
0
        public DumpDeploymentsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
            : base(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; });
        }
        public DummyApiCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
            : base(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);
        }
示例#5
0
        public DummyApiCommand(IOctopusRepositoryFactory repositoryFactory, ILog log) : base(repositoryFactory, log)
        {
            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);
        }
 public ListLatestDeploymentsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(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));
 }
 public DeployReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     DeployToEnvironmentNames = new List<string>();
     DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
     DeploymentTimeout = TimeSpan.FromMinutes(10);
 }
示例#8
0
        public ListReleasesCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
            : base(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));
        }
示例#9
0
 public DeployReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     DeployToEnvironmentNames        = new List <string>();
     DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
     DeploymentTimeout = TimeSpan.FromMinutes(10);
 }
示例#10
0
        public CreateReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IPackageVersionResolver versionResolver, IReleasePlanBuilder releasePlanBuilder)
            : base(repositoryFactory, log, fileSystem)
        {
            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));
        }
 public CreateEnvironmentCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(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);
 }
示例#12
0
 public PushCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(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);
 }
        public CreateReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IPackageVersionResolver versionResolver)
            : base(repositoryFactory, log)
        {
            this.versionResolver = versionResolver;

            DeployToEnvironmentNames = new List<string>();
            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("channel=", "[Optional] Channel to use for the new release.", v => ChannelName = v);
            options.Add("version=|releaseNumber=", "[Optional] Release number to use for the new release.", v => VersionNumber = v);
            options.Add("packageversion=|defaultpackageversion=", "Default version number of all packages to use for this release.", v => versionResolver.Default(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", "If a release with the version number already exists, ignore it", v => IgnoreIfAlreadyExists = true);
            options.Add("ignorechannelrules", "[Optional] Ignore package version matching rules", v => Force = true);
            options.Add("packageprerelease=", "[Optional] Pre-release for latest version of all packages to use for this release.", v => VersionPrerelease = v);

            options = Options.For("Deployment");
            options.Add("deployto=", "[Optional] Environment to automatically deploy to, e.g., Production", v => DeployToEnvironmentNames.Add(v));
        }
        public CreateReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IPackageVersionResolver versionResolver)
            : base(repositoryFactory, log)
        {
            this.versionResolver = versionResolver;

            DeployToEnvironmentNames        = new List <string>();
            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("channel=", "[Optional] Channel to use for the new release.", v => ChannelName = v);
            options.Add("version=|releaseNumber=", "[Optional] Release number to use for the new release.", v => VersionNumber = v);
            options.Add("packageversion=|defaultpackageversion=", "Default version number of all packages to use for this release.", v => versionResolver.Default(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", "If a release with the version number already exists, ignore it", v => IgnoreIfAlreadyExists = true);
            options.Add("ignorechannelrules", "[Optional] Ignore package version matching rules", v => Force = true);
            options.Add("packageprerelease=", "[Optional] Pre-release for latest version of all packages to use for this release.", v => VersionPrerelease = v);

            options = Options.For("Deployment");
            options.Add("deployto=", "[Optional] Environment to automatically deploy to, e.g., Production", v => DeployToEnvironmentNames.Add(v));
        }
示例#15
0
        public MigrateCommand(IOctopusRepositoryFactory octopusRepositoryFactory)
            : base(octopusRepositoryFactory)
        {
            var options = Options.For("Multi-tenant sample");

            options.Add("include=", "[Optional] Include environments where the name matches this regex. Default is to migrate all environments.", v => include = v);
            options.Add("exclude=", "[Optional] Exclude environments where the name matches this regex. Default is to migrate all environments.", v => exclude = v);
        }
        public CreateEnvironmentCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
            : base(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);
        }
示例#17
0
        public ListMachinesCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
            : base(repositoryFactory, log, fileSystem)
        {
            var options = Options.For("Listing");

            options.Add("environment=", "Name of an environment to filter by. Can be specified many times.", v => environments.Add(v));
            options.Add("status=", string.Format("Status of Machines filter by ({0}). Can be specified many times.", string.Join(", ", StatusNames)), v => statuses.Add(v));
        }
 public CreateProjectCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     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("ignoreIfExists", "If the project already exists, an error will be returned. Set this flag to ignore the error.", v => IgnoreIfExists = true);
 }
示例#19
0
        public PushCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
            : base(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);
        }
        public ListLatestDeploymentsCommand(IOctopusRepositoryFactory repositoryFactory, Serilog.ILogger log, IOctopusFileSystem fileSystem)
            : base(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));
        }
示例#21
0
        public CreateReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IPackageVersionResolver versionResolver)
            : base(repositoryFactory, log)
        {
            this.versionResolver = versionResolver;

            DeployToEnvironmentNames        = new List <string>();
            DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
            DeploymentTimeout = TimeSpan.FromMinutes(10);
        }
 public DeleteReleasesCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     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("whatif", "[Optional, Flag] if specified, releases won't actually be deleted, but will be listed as if simulating the command", v => WhatIf = true);
 }
        public CreateReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IPackageVersionResolver versionResolver)
            : base(repositoryFactory, log)
        {
            this.versionResolver = versionResolver;

            DeployToEnvironmentNames = new List<string>();
            DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
            DeploymentTimeout = TimeSpan.FromMinutes(10);
        }
        public DeleteReleasesCommand(IOctopusRepositoryFactory repositoryFactory, ILog log) : base(repositoryFactory, log)
        {
            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("whatif", "[Optional, Flag] if specified, releases won't actually be deleted, but will be listed as if simulating the command", v => WhatIf = true);
        }
        public CreateProjectCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(repositoryFactory, log)
        {
            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("ignoreIfExists", "If the project already exists, an error will be returned. Set this flag to ignore the error.", v => IgnoreIfExists           = true);
        }
        public PromoteReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
            : base(repositoryFactory, log, fileSystem)
        {
            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));
        }
 public CleanEnvironmentCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(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 to clean up (Online, Offline, NeedsUpgrade, CalamariNeedsUpgrade, Disabled).", v =>
     {
         Enum.TryParse(v, true, out status);
     });
 }
        public PromoteReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log) : base(repositoryFactory, log)
        {
            DeployToEnvironmentNames = new List <string>();

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

            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));
        }
        public PromoteReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(repositoryFactory, log)
        {
            DeployToEnvironmentNames = new List<string>();

            var options = Options.For("Project creation");
            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));
        }
示例#30
0
        public DeleteReleasesCommand(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
            : base(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);
        }
示例#31
0
        public CreateChannelCommand(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem) : base(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);
        }
示例#32
0
        public CleanEnvironmentCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
            : base(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 to clean up (Online, Offline, NeedsUpgrade, CalamariNeedsUpgrade, Disabled).", v =>
            {
                Enum.TryParse(v, true, out status);
            });
        }
示例#33
0
        public ImportCommand(IImporterLocator importerLocator, IOctopusFileSystem fileSystem, IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(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);
        }
        public DeployReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(repositoryFactory, log)
        {
            DeployToEnvironmentNames = new List<string>();
            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);
        }
示例#35
0
        public ExportCommand(IExporterLocator exporterLocator, IOctopusFileSystem fileSystem, IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(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);
        }
        public CleanEnvironmentCommand(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
            : base(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));
        }
        protected ApiCommand(IOctopusRepositoryFactory repositoryFactory)
        {
            this.repositoryFactory = repositoryFactory;

            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);
        }
示例#38
0
        public DeployReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem)
            : base(repositoryFactory, log, fileSystem)
        {
            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);
        }
        public DeployReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(repositoryFactory, log)
        {
            DeployToEnvironmentNames        = new List <string>();
            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.", v => VersionNumber = v);
        }
示例#40
0
        protected ApiCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
        {
            this.repositoryFactory = repositoryFactory;
            this.log = log;

            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 => user = v);
            options.Add("pass="******"[Optional] Password to use when authenticating with the server.", v => pass = v);
            options.Add("configFile=", "[Optional] Text file of default values, with one 'key = value' per line.", v => ReadAdditionalInputsFromConfigurationFile(options, 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 service messages when logging.", v => log.EnableServiceMessages());
        }
示例#41
0
        protected ApiCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
        {
            this.repositoryFactory = repositoryFactory;
            this.log = log;

            options = new OptionSet();
            options.Add("server=", "The base URL for your Octopus server - e.g., http://your-octopus/", v => serverBaseUrl = v);
            options.Add("user="******"[Optional] Username to use when authenticating with the server.", v => user = v);
            options.Add("pass="******"[Optional] Password to use when authenticating with the server.", v => pass = v);
            options.Add("apiKey=", "Your API key. Get this from the user profile page.", v => apiKey          = v);
            options.Add("configFile=", "[Optional] Text file of default values, with one 'key = value' per line.", v => ReadAdditionalInputsFromConfigurationFile(options, 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", "Enable TeamCity service messages when logging.", v => log.EnableServiceMessages());
        }
示例#42
0
        public DeleteAutoDeployOverrideCommand(IOctopusRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem) :
            base(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));
        }
        public void BaseSetup()
        {
            Log = Substitute.For<ILog>();

            RootResource rootDocument = Substitute.For<RootResource>();
            rootDocument.ApiVersion = "2.0";
            rootDocument.Version = "2.0";

            Repository = Substitute.For<IOctopusRepository>();
            Repository.Client.RootDocument.Returns(rootDocument);

            RepositoryFactory = Substitute.For<IOctopusRepositoryFactory>();
            RepositoryFactory.CreateRepository(null).ReturnsForAnyArgs(Repository);

            CommandLineArgs = new List<string>
            {
                "--server=http://the-server",
                "--apiKey=ABCDEF123456789"
            };
        }
        protected DeploymentCommandBase(IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(repositoryFactory, log)
        {
            SpecificMachineNames = new List<string>();
            SkipStepNames = 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 deployment can take (default 00:10:00)", v => DeploymentTimeout = TimeSpan.Parse(v));
            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));
        }
 public ListEnvironmentsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
 }
 public DummyApiCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
 }
示例#47
0
        public ExportCommand(IExporterLocator exporterLocator, IOctopusFileSystem fileSystem, IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(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);
        }
 public ListReleasesCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     var options = Options.For("Listing");
     options.Add("project=", "Name of a project to filter by. Can be specified many times.", v => projects.Add(v));
 }
 public DumpDeploymentsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(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; });
 }
 public ListProjectsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
 }
 public CreateProjectCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
 }
 public PromoteReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     DeployToEnvironmentNames = new List<string>();
 }
示例#53
0
        public ImportCommand(IImporterLocator importerLocator, IOctopusFileSystem fileSystem, IOctopusRepositoryFactory repositoryFactory, ILog log)
            : base(repositoryFactory, log)
        {
            this.importerLocator = importerLocator;
            this.fileSystem      = fileSystem;

            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);
        }
 public DeleteReleasesCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
 }
 public ListEnvironmentsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(repositoryFactory, log, fileSystem)
 {
 }
 public CreateEnvironmentCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
 }
 protected DeploymentCommandBase(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     SpecificMachineNames = new List<string>();
 }
 public ListEnvironmentsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IOctopusFileSystem fileSystem)
     : base(repositoryFactory, log, fileSystem)
 {
 }
 public ListLatestDeploymentsCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
 }
 protected DeploymentCommandBase(IOctopusRepositoryFactory repositoryFactory, ILog log) : base(repositoryFactory, log)
 {
     SpecificMachineNames = new List <string>();
     SkipStepNames        = new List <string>();
 }