Skip to content

Commit

Permalink
Merge branch 'redo-lowercase_3.1_selfcontained'
Browse files Browse the repository at this point in the history
  • Loading branch information
thedewi committed Feb 17, 2020
2 parents ddfd7f1 + b362c0c commit e2b4833
Show file tree
Hide file tree
Showing 21 changed files with 53 additions and 53 deletions.
1 change: 0 additions & 1 deletion BuildAssets/Octo.cmd

This file was deleted.

8 changes: 4 additions & 4 deletions BuildAssets/OctopusTools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" xmlns:octopus="http://octopus.org">
<metadata>
<id>OctopusTools</id>
<title>Octo.exe</title>
<title>Octopus CLI</title>
<version>$version$</version>
<authors>Octopus Deploy</authors>
<owners>Octopus Deploy</owners>
<summary>Create, deploy and promote releases using Octopus Deploy.</summary>
<description>
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.
</description>
<releaseNotes></releaseNotes>
<language>en-US</language>
Expand Down
4 changes: 2 additions & 2 deletions BuildAssets/Octo → BuildAssets/octo
Original file line number Diff line number Diff line change
Expand Up @@ -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" "$@"
1 change: 1 addition & 0 deletions BuildAssets/octo.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet "%~dp0/octo.dll" %*
4 changes: 2 additions & 2 deletions Dockerfiles/Readme.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions Dockerfiles/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM microsoft/dotnet:2.1-runtime-alpine
MAINTAINER robert.erez [email protected]
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-alpine

#alpine doesnt have curl installed
#RUN apk add --no-cache curl
Expand All @@ -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

Expand All @@ -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"]
3 changes: 1 addition & 2 deletions Dockerfiles/nanoserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM microsoft/dotnet:2.1-runtime-nanoserver-sac2016
MAINTAINER robert.erez [email protected]
ARG OCTO_TOOLS_VERSION=4.31.1

LABEL maintainer="[email protected]" \
Expand All @@ -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"]
30 changes: 17 additions & 13 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -145,27 +145,30 @@ 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(() => {
var inputFolder = $"{octoPublishFolder}/netfx";
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),
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion source/Octo.Tests/Commands/HelpCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void ShouldPrintGeneralHelpWhenNoArgsGiven()

output.ToString()
.Should()
.Contain("Usage: octo <command> [<options>]")
.MatchRegex(@"Usage: (octo|testhost) <command> \[<options>\]")
.And.Contain("Where <command> is one of:")
.And.Contain("create-foo");
}
Expand Down
8 changes: 4 additions & 4 deletions source/Octo.Tests/Octo.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="!$([MSBuild]::IsOSUnixLike())">net452;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSUnixLike())">netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSUnixLike())">net452;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSUnixLike())">netcoreapp3.1</TargetFrameworks>
<AssemblyName>Octo.Tests</AssemblyName>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);HAS_APP_CONTEXT</DefineConstants>
</PropertyGroup>

Expand Down Expand Up @@ -47,7 +47,7 @@
</ItemGroup>


<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PackageReference Include="Microsoft.AspNetCore.Owin" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.0.0" />
Expand Down
10 changes: 5 additions & 5 deletions source/Octo/Octo.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="!$([MSBuild]::IsOSUnixLike())">net451;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSUnixLike())">netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSUnixLike())">net451;netcoreapp2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSUnixLike())">netcoreapp2.0;netcoreapp3.1</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>portable</DebugType>
<AssemblyName>Octo</AssemblyName>
<AssemblyName>octo</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>OctopusTools</PackageId>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
Expand All @@ -17,9 +17,9 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);HTTP_CLIENT_SUPPORTS_SSL_OPTIONS</DefineConstants>
<RuntimeIdentifiers>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</RuntimeIdentifiers>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net451' ">
Expand Down
3 changes: 2 additions & 1 deletion source/Octopus.Cli/CliProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Octopus.Client;
using Octopus.Client.Exceptions;
using Serilog;
using AssemblyExtensions = Octopus.Cli.Util.AssemblyExtensions;

namespace Octopus.Cli
{
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.Cli/Commands/ApiCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.Cli/Commands/ExportCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 1 addition & 4 deletions source/Octopus.Cli/Commands/HelpCommand.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -29,7 +26,7 @@ public Task Execute(string[] commandLineArguments)

commandOutputProvider.PrintMessages = OutputFormat == OutputFormat.Default;

executable = "octo";
executable = AssemblyExtensions.GetExecutableName();

var commandName = commandLineArguments.FirstOrDefault();

Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.Cli/Commands/ImportCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.Cli/Commands/VersionCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.Cli/Util/FeatureDetectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static async Task<bool> 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");
}
Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.DotNet.Cli/Octopus.DotNet.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<PackAsTool>True</PackAsTool>
<AssemblyName>dotnet-octo</AssemblyName>

Expand Down
2 changes: 1 addition & 1 deletion tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.24.0" />
<package id="Cake" version="0.36.0" />
</packages>

0 comments on commit e2b4833

Please sign in to comment.