Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</Otherwise>
</Choose>
<ItemGroup>
<PackageReference Include="Halibut" Version="8.1.1040" />
<PackageReference Include="Halibut" Version="8.1.1276-pull-663" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Solution Items\SolutionInfo.cs">
Expand Down
20 changes: 18 additions & 2 deletions source/Octopus.Tentacle/Commands/RunAgentCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Threading.Tasks;
using Octopus.Tentacle.Background;
using Octopus.Tentacle.Communications;
using Octopus.Tentacle.Configuration;
using Octopus.Tentacle.Configuration.Instances;
using Octopus.Tentacle.Core.Diagnostics;
using Octopus.Tentacle.Kubernetes;
using Octopus.Tentacle.Maintenance;
using Octopus.Tentacle.Startup;
using Octopus.Tentacle.Util;
using Octopus.Tentacle.Variables;
Expand All @@ -38,6 +37,7 @@ public class RunAgentCommand : AbstractStandardCommand
readonly IEnumerable<Lazy<IBackgroundTask>> backgroundTasks;
int wait;
bool halibutHasStarted;
string? relayConnectAddress;

public override bool CanRunAsService => true;

Expand Down Expand Up @@ -67,6 +67,7 @@ public RunAgentCommand(
this.appVersion = appVersion;
this.backgroundTasks = backgroundTasks;

Options.Add("relay-connect-address=", "Connect address of the relay", arg => relayConnectAddress = arg);
Options.Add("wait=", "Delay (ms) before starting", arg => wait = int.Parse(arg));
Options.Add("console", "Don't attempt to run as a service, even if the user is non-interactive", v =>
{
Expand Down Expand Up @@ -134,6 +135,21 @@ protected override void Start()
backgroundTaskLazy.Value.Start();
}

#if NET8_0_OR_GREATER

if (relayConnectAddress != null)
{
log.InfoFormat("Enabling connection agent via {0}", relayConnectAddress);

Task.Run(async () =>
{
var agent = new Octopus.Tentacle.SocksProxy.Agent(relayConnectAddress);
await agent.StartAsync();
});
}

#endif

Runtime.WaitForUserToExit();
}

Expand Down
3 changes: 3 additions & 0 deletions source/Octopus.Tentacle/Octopus.Tentacle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
<PackageReference Include="Nito.AsyncEx" Version="5.0.0" />
<PackageReference Include="NLog" Version="5.0.4" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0' And '$(TargetFramework)' != 'net8.0-windows'">
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
Expand Down Expand Up @@ -118,6 +120,7 @@
<ProjectReference Include="..\Octopus.Tentacle.Contracts\Octopus.Tentacle.Contracts.csproj" />
<ProjectReference Include="..\Octopus.Tentacle.Core\Octopus.Tentacle.Core.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Internals\Options\_Readme.txt" />
<EmbeddedResource Include="Startup\PathsToDeleteOnStartup.core.txt" />
Expand Down
Loading