diff --git a/BuildAssets/Octo.cmd b/BuildAssets/Octo.cmd deleted file mode 100644 index 0b33475036..0000000000 --- a/BuildAssets/Octo.cmd +++ /dev/null @@ -1 +0,0 @@ -dotnet "%~dp0/Octo.dll" %* \ No newline at end of file diff --git a/BuildAssets/OctopusTools.nuspec b/BuildAssets/OctopusTools.nuspec index fb339ad5ec..b80e7128fa 100644 --- a/BuildAssets/OctopusTools.nuspec +++ b/BuildAssets/OctopusTools.nuspec @@ -2,15 +2,15 @@ OctopusTools - Octo.exe + Octopus CLI $version$ Octopus Deploy Octopus Deploy Create, deploy and promote releases using Octopus Deploy. - Octopus Deploy is an automated release management tool for modern developers and DevOps teams. - - This package contains Octo.exe, a command line tool for creating and deploying releases with Octopus Deploy. + Octopus is a user-friendly DevOps tool for developers that supports release management, deployment automation, and operations runbooks. + + This package contains the Octopus CLI (octo), a tool to create and deploy releases, create and push packages, and manage environments with Octopus. en-US diff --git a/BuildAssets/Octo b/BuildAssets/octo similarity index 85% rename from BuildAssets/Octo rename to BuildAssets/octo index 6cee4c47a7..e7c1475591 100644 --- a/BuildAssets/Octo +++ b/BuildAssets/octo @@ -5,7 +5,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located done -cd -P "$( dirname "$SOURCE" )" +OCTO_PATH="$( dirname "$SOURCE")/octo.dll" # LTTNG_UST_REGISTER_TIMEOUT=0 is there to work around a bug in docker that causes an assertion violation in dotnet on first launch # See https://github.com/dotnet/cli/issues/1582 -LTTNG_UST_REGISTER_TIMEOUT=0 dotnet Octo.dll "$@" +LTTNG_UST_REGISTER_TIMEOUT=0 dotnet "$OCTO_PATH" "$@" diff --git a/BuildAssets/octo.cmd b/BuildAssets/octo.cmd new file mode 100644 index 0000000000..5ef73ff54c --- /dev/null +++ b/BuildAssets/octo.cmd @@ -0,0 +1 @@ +dotnet "%~dp0/octo.dll" %* \ No newline at end of file diff --git a/Dockerfiles/Readme.md b/Dockerfiles/Readme.md index 34a0c36930..868e36b3c5 100644 --- a/Dockerfiles/Readme.md +++ b/Dockerfiles/Readme.md @@ -1,5 +1,5 @@ # octopusdeploy/octo -A docker wrapped version of the popular [octo.exe](https://octopus.com/docs/api-and-integration/octo.exe-command-line) command line tool +A docker wrapped version of the popular Octopus CLI, [octo](https://octopus.com/docs/api-and-integration/octo.exe-command-line) ## Platforms Images are currently available for @@ -8,7 +8,7 @@ Images are currently available for ## Command Options -Arguments passed to the container will be passed directly to the `octo.exe` tool internally. For the full list of commands and parameters [read our docs](https://octopus.com/docs/api-and-integration/octo.exe-command-line). +Arguments passed to the container will be passed directly to the `octo` tool internally. For the full list of commands and parameters [read our docs](https://octopus.com/docs/api-and-integration/octo.exe-command-line). ### Example Usage #### Help diff --git a/Dockerfiles/alpine/Dockerfile b/Dockerfiles/alpine/Dockerfile index cbd8431987..b5210bc9f2 100644 --- a/Dockerfiles/alpine/Dockerfile +++ b/Dockerfiles/alpine/Dockerfile @@ -1,5 +1,4 @@ -FROM microsoft/dotnet:2.1-runtime-alpine -MAINTAINER robert.erez devops@octopus.com +FROM mcr.microsoft.com/dotnet/core/runtime:3.1-alpine #alpine doesnt have curl installed #RUN apk add --no-cache curl @@ -14,7 +13,7 @@ ENV LANG en_US.UTF-8 # The dotnetcore bootstrapper doesnt work in alpine shell (built for bash) # This allows invoking octo if running interactive container RUN mkdir /octo &&\ - echo "dotnet /octo/Octo.dll \"\$@\"" > /octo/alpine &&\ + echo "dotnet /octo/octo.dll \"\$@\"" > /octo/alpine &&\ ln /octo/alpine /usr/bin/octo &&\ chmod +x /usr/bin/octo @@ -31,4 +30,4 @@ RUN tar -zxvf /tmp/OctopusTools.$OCTO_TOOLS_VERSION.portable.tar.gz -C /octo &&\ WORKDIR /src -ENTRYPOINT ["dotnet", "/octo/Octo.dll"] +ENTRYPOINT ["dotnet", "/octo/octo.dll"] diff --git a/Dockerfiles/nanoserver/Dockerfile b/Dockerfiles/nanoserver/Dockerfile index 372fc960ef..6f67300029 100644 --- a/Dockerfiles/nanoserver/Dockerfile +++ b/Dockerfiles/nanoserver/Dockerfile @@ -1,5 +1,4 @@ FROM microsoft/dotnet:2.1-runtime-nanoserver-sac2016 -MAINTAINER robert.erez devops@octopus.com ARG OCTO_TOOLS_VERSION=4.31.1 LABEL maintainer="devops@octopus.com" \ @@ -14,4 +13,4 @@ RUN Invoke-WebRequest $Env:OCTO_TOOLS_DOWNLOAD_URL -OutFile OctopusTools.zip; \ mkdir src |Out-Null WORKDIR /src -ENTRYPOINT ["dotnet", "/octo/Octo.dll"] +ENTRYPOINT ["dotnet", "/octo/octo.dll"] diff --git a/build.cake b/build.cake index bf2a64f08e..de4b7b18ec 100644 --- a/build.cake +++ b/build.cake @@ -4,7 +4,7 @@ #tool "nuget:?package=GitVersion.CommandLine&version=4.0.0" #tool "nuget:?package=ILRepack&version=2.0.13" #addin "nuget:?package=SharpCompress&version=0.12.4" -#addin "nuget:?package=Cake.Incubator&version=4.0.0" +#addin "nuget:?package=Cake.Incubator&version=5.1.0" using SharpCompress; using SharpCompress.Common; @@ -128,15 +128,15 @@ Task("DotnetPublish") var portablePublishDir = $"{octoPublishFolder}/portable"; DotNetCorePublish(projectToPublish, new DotNetCorePublishSettings { - Framework = "netcoreapp2.0", + Framework = "netcoreapp2.0" /* For compatibility until we gently phase it out. We encourage upgrading to self-contained executable. */, Configuration = configuration, OutputDirectory = portablePublishDir, ArgumentCustomization = args => args.Append($"/p:Version={nugetVersion}") }); SignBinaries(portablePublishDir); - CopyFileToDirectory($"{assetDir}/Octo", portablePublishDir); - CopyFileToDirectory($"{assetDir}/Octo.cmd", portablePublishDir); + CopyFileToDirectory($"{assetDir}/octo", portablePublishDir); + CopyFileToDirectory($"{assetDir}/octo.cmd", portablePublishDir); var doc = new XmlDocument(); doc.Load(@".\source\Octo\Octo.csproj"); @@ -145,18 +145,21 @@ Task("DotnetPublish") { DotNetCorePublish(projectToPublish, new DotNetCorePublishSettings { - Framework = "netcoreapp2.0", + Framework = "netcoreapp3.1", Configuration = configuration, Runtime = rid, OutputDirectory = $"{octoPublishFolder}/{rid}", - ArgumentCustomization = args => args.Append($"/p:Version={nugetVersion}") + ArgumentCustomization = args => args.Append($"/p:Version={nugetVersion}"), + SelfContained = true, + PublishSingleFile = true }); - SignBinaries($"{octoPublishFolder}/{rid}"); + if (!rid.StartsWith("linux-") && !rid.StartsWith("osx-")) { + // Sign binaries, except linux which are verified at download, and osx which are signed on a mac + SignBinaries($"{octoPublishFolder}/{rid}"); + } } - }); - Task("MergeOctoExe") .IsDependentOn("DotnetPublish") .Does(() => { @@ -164,8 +167,8 @@ Task("MergeOctoExe") var outputFolder = $"{octoPublishFolder}/netfx-merged"; CreateDirectory(outputFolder); ILRepack( - $"{outputFolder}/Octo.exe", - $"{inputFolder}/Octo.exe", + $"{outputFolder}/octo.exe", + $"{inputFolder}/octo.exe", System.IO.Directory.EnumerateFiles(inputFolder, "*.dll") .Union(System.IO.Directory.EnumerateFiles(inputFolder, "octodiff.exe")) .Select(f => (FilePath) f), @@ -270,8 +273,9 @@ private void SignBinaries(string path) { Information($"Signing binaries in {path}"); var files = GetFiles(path + "/**/Octopus.*.dll"); - files.Add(GetFiles(path + "/**/Octo.dll")); - files.Add(GetFiles(path + "/**/Octo.exe")); + files.Add(GetFiles(path + "/**/octo.dll")); + files.Add(GetFiles(path + "/**/octo.exe")); + files.Add(GetFiles(path + "/**/octo")); files.Add(GetFiles(path + "/**/dotnet-octo.dll")); Sign(files, new SignToolSignSettings { diff --git a/readme.md b/readme.md index 74b6ebf2b1..f5822e5936 100644 --- a/readme.md +++ b/readme.md @@ -1,9 +1,9 @@ -This repository contains the command line tool (`Octo.exe`) for [Octopus Deploy][1], an automated deployment server for professional .NET developers. You can use it to create and deploy releases, create and push packages, and manage environments. +This repository contains the Octopus CLI (`octo`) for [Octopus][1], a user-friendly DevOps tool for developers that supports release management, deployment automation, and operations runbooks. You can use it to create and deploy releases, create and push packages, and manage environments. -`Octo.exe` can be [downloaded from the Octopus downloads page][2]. +`octo` can be [downloaded from the Octopus downloads page][2]. ## Documentation -- [Octo.exe][3] +- [octo][3] ## Issues Please see [Contributing](CONTRIBUTING.md) diff --git a/source/Octo.Tests/Commands/HelpCommandFixture.cs b/source/Octo.Tests/Commands/HelpCommandFixture.cs index 39cac32784..f6d55dacf5 100644 --- a/source/Octo.Tests/Commands/HelpCommandFixture.cs +++ b/source/Octo.Tests/Commands/HelpCommandFixture.cs @@ -47,7 +47,7 @@ public void ShouldPrintGeneralHelpWhenNoArgsGiven() output.ToString() .Should() - .Contain("Usage: octo []") + .MatchRegex(@"Usage: (octo|testhost) \[\]") .And.Contain("Where is one of:") .And.Contain("create-foo"); } diff --git a/source/Octo.Tests/Octo.Tests.csproj b/source/Octo.Tests/Octo.Tests.csproj index af25f8529a..9db2b56a70 100644 --- a/source/Octo.Tests/Octo.Tests.csproj +++ b/source/Octo.Tests/Octo.Tests.csproj @@ -1,15 +1,15 @@  - net452;netcoreapp2.0 - netcoreapp2.0 + net452;netcoreapp3.1 + netcoreapp3.1 Octo.Tests true false true - + $(DefineConstants);HAS_APP_CONTEXT @@ -47,7 +47,7 @@ - + diff --git a/source/Octo/Octo.csproj b/source/Octo/Octo.csproj index 60262ca3ff..7dbbf3e586 100644 --- a/source/Octo/Octo.csproj +++ b/source/Octo/Octo.csproj @@ -1,11 +1,11 @@  - net451;netcoreapp2.0 - netcoreapp2.0 + net451;netcoreapp2.0;netcoreapp3.1 + netcoreapp2.0;netcoreapp3.1 true portable - Octo + octo Exe OctopusTools false @@ -17,9 +17,9 @@ true - + $(DefineConstants);HTTP_CLIENT_SUPPORTS_SSL_OPTIONS - win7-x64;win7-x86;osx.10.10-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;rhel.7-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64;linuxmint.17-x64;centos.7-x64;linux-x64;osx-x64 + win-x64;linux-x64;osx-x64 diff --git a/source/Octopus.Cli/CliProgram.cs b/source/Octopus.Cli/CliProgram.cs index c1bbeb9054..b658f2c46d 100644 --- a/source/Octopus.Cli/CliProgram.cs +++ b/source/Octopus.Cli/CliProgram.cs @@ -14,6 +14,7 @@ using Octopus.Client; using Octopus.Client.Exceptions; using Serilog; +using AssemblyExtensions = Octopus.Cli.Util.AssemblyExtensions; namespace Octopus.Cli { @@ -154,7 +155,7 @@ static int PrintError(Exception ex) Log.Error(ex.Message); if (LogExtensions.IsKnownEnvironment()) { - Log.Error("This error is most likely occurring while executing Octo.exe as part of an automated build process. The following doc is recommended to get some tips on how to troubleshoot this: https://g.octopushq.com/OctoexeTroubleshooting"); + Log.Error($"This error is most likely occurring while executing {AssemblyExtensions.GetExecutableName()} as part of an automated build process. The following doc is recommended to get some tips on how to troubleshoot this: https://g.octopushq.com/OctoexeTroubleshooting"); } return -1; } diff --git a/source/Octopus.Cli/Commands/ApiCommand.cs b/source/Octopus.Cli/Commands/ApiCommand.cs index 4bd88c27c0..5072404677 100644 --- a/source/Octopus.Cli/Commands/ApiCommand.cs +++ b/source/Octopus.Cli/Commands/ApiCommand.cs @@ -188,7 +188,7 @@ public async Task Execute(string[] commandLineArguments) { if (!serverHasSpaces) { - throw new CommandException($"The server {endpoint.OctopusServer} has no spaces. Try invoking the Octo tool without specifying the space name as an argument"); + throw new CommandException($"The server {endpoint.OctopusServer} has no spaces. Try invoking {AssemblyExtensions.GetExecutableName()} without specifying the space name as an argument"); } var space = await client.ForSystem().Spaces.FindByNameOrIdOrFail(spaceNameOrId).ConfigureAwait(false); diff --git a/source/Octopus.Cli/Commands/ExportCommand.cs b/source/Octopus.Cli/Commands/ExportCommand.cs index e68932b5f8..6f2960f1df 100644 --- a/source/Octopus.Cli/Commands/ExportCommand.cs +++ b/source/Octopus.Cli/Commands/ExportCommand.cs @@ -34,7 +34,7 @@ public ExportCommand(IExporterLocator exporterLocator, IOctopusFileSystem fileSy protected override Task Execute() { - commandOutputProvider.Warning("The octo.exe import/export commands have been deprecated. See https://g.octopushq.com/DataMigration for alternative options."); + commandOutputProvider.Warning($"The {AssemblyExtensions.GetExecutableName()} import/export commands have been deprecated. See https://g.octopushq.com/DataMigration for alternative options."); if (string.IsNullOrWhiteSpace(Type)) throw new CommandException("Please specify the type to export using the parameter: --type=XYZ"); if (string.IsNullOrWhiteSpace(FilePath)) throw new CommandException("Please specify the full path and name of the export file using the parameter: --filePath=XYZ"); diff --git a/source/Octopus.Cli/Commands/HelpCommand.cs b/source/Octopus.Cli/Commands/HelpCommand.cs index 00306f26ac..42337da177 100644 --- a/source/Octopus.Cli/Commands/HelpCommand.cs +++ b/source/Octopus.Cli/Commands/HelpCommand.cs @@ -1,12 +1,9 @@ using System; -using System.IO; using System.Linq; -using System.Reflection; using System.Threading.Tasks; using Octopus.Cli.Infrastructure; using Octopus.Cli.Model; using Octopus.Cli.Util; -using Serilog; namespace Octopus.Cli.Commands { @@ -29,7 +26,7 @@ public Task Execute(string[] commandLineArguments) commandOutputProvider.PrintMessages = OutputFormat == OutputFormat.Default; - executable = "octo"; + executable = AssemblyExtensions.GetExecutableName(); var commandName = commandLineArguments.FirstOrDefault(); diff --git a/source/Octopus.Cli/Commands/ImportCommand.cs b/source/Octopus.Cli/Commands/ImportCommand.cs index 1e363b165c..3f4bca1318 100644 --- a/source/Octopus.Cli/Commands/ImportCommand.cs +++ b/source/Octopus.Cli/Commands/ImportCommand.cs @@ -32,7 +32,7 @@ public ImportCommand(IImporterLocator importerLocator, IOctopusFileSystem fileSy protected override async Task Execute() { - commandOutputProvider.Warning("The octo.exe import/export commands have been deprecated. See https://g.octopushq.com/DataMigration for alternative options."); + commandOutputProvider.Warning($"The {AssemblyExtensions.GetExecutableName()} import/export commands have been deprecated. See https://g.octopushq.com/DataMigration for alternative options."); if (string.IsNullOrWhiteSpace(Type)) throw new CommandException("Please specify the type of object to import using the parameter: --type=XYZ"); if (string.IsNullOrWhiteSpace(FilePath)) throw new CommandException("Please specify the full path and name of the export file to import using the parameter: --filePath=XYZ"); diff --git a/source/Octopus.Cli/Commands/VersionCommand.cs b/source/Octopus.Cli/Commands/VersionCommand.cs index 441a1e1d46..377d24f863 100644 --- a/source/Octopus.Cli/Commands/VersionCommand.cs +++ b/source/Octopus.Cli/Commands/VersionCommand.cs @@ -5,7 +5,7 @@ namespace Octopus.Cli.Commands { - [Command("version", "v", "ver", Description = "Output Octo command line tool version.")] + [Command("version", "v", "ver", Description = "Output Octopus CLI version.")] public class VersionCommand : CommandBase, ICommand { public VersionCommand(ICommandOutputProvider commandOutputProvider) : base(commandOutputProvider) diff --git a/source/Octopus.Cli/Util/FeatureDetectionExtensions.cs b/source/Octopus.Cli/Util/FeatureDetectionExtensions.cs index 3330236a5d..9480b4bc8f 100644 --- a/source/Octopus.Cli/Util/FeatureDetectionExtensions.cs +++ b/source/Octopus.Cli/Util/FeatureDetectionExtensions.cs @@ -32,7 +32,7 @@ public static async Task SupportsTenants(this IOctopusAsyncRepository repo public static bool UsePostForChannelVersionRuleTest(this RootResource source) { - // Assume octo.exe 3.4 should use the OctopusServer 3.4 POST, otherwise if we're certain this is an older Octopus Server use the GET method + // Assume octo 3.4 should use the OctopusServer 3.4 POST, otherwise if we're certain this is an older Octopus Server use the GET method SemanticVersion octopusServerVersion; return source == null || !SemanticVersion.TryParse(source.Version, out octopusServerVersion) || octopusServerVersion >= new SemanticVersion("3.4"); } diff --git a/source/Octopus.DotNet.Cli/Octopus.DotNet.Cli.csproj b/source/Octopus.DotNet.Cli/Octopus.DotNet.Cli.csproj index fbeb364a15..396f1016ca 100644 --- a/source/Octopus.DotNet.Cli/Octopus.DotNet.Cli.csproj +++ b/source/Octopus.DotNet.Cli/Octopus.DotNet.Cli.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + netcoreapp2.1;netcoreapp3.1 True dotnet-octo diff --git a/tools/packages.config b/tools/packages.config index d654602931..14aef3bf00 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - +