From f27d4b781f32c6d889b3f6d0a5f6b9794acc5ee6 Mon Sep 17 00:00:00 2001 From: Samdanae Imran Date: Wed, 15 May 2024 12:12:30 +1200 Subject: [PATCH 1/5] Include version in log output --- .../Scripts/ScriptOrchestratorFactory.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs b/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs index 211db51f2..6e9925c8a 100644 --- a/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs +++ b/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs @@ -1,4 +1,6 @@ using System; +using System.Diagnostics; +using System.Reflection; using System.Threading; using System.Threading.Tasks; using Halibut.ServiceModel; @@ -150,6 +152,9 @@ async Task GetCapabilitiesFunc(CancellationToken ct) cancellationToken); logger.Verbose($"Discovered Tentacle capabilities: {string.Join(",", tentacleCapabilities.SupportedCapabilities)}"); + + var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location); + logger.Verbose($"Tentacle Version: {fileVersionInfo.ProductVersion}"); // Check if we support any kubernetes script service. // It's implied (and tested) that GetCapabilities will only return Kubernetes or non-Kubernetes script services, never a mix From f47fd33187a2ff8d313d896361ee877b7beb5cd8 Mon Sep 17 00:00:00 2001 From: Samdanae Imran Date: Wed, 15 May 2024 13:06:45 +1200 Subject: [PATCH 2/5] Move log to capabilities service --- .../Scripts/ScriptOrchestratorFactory.cs | 3 --- .../Services/Capabilities/CapabilitiesServiceV2.cs | 12 +++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs b/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs index 6e9925c8a..a115c0058 100644 --- a/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs +++ b/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs @@ -152,9 +152,6 @@ async Task GetCapabilitiesFunc(CancellationToken ct) cancellationToken); logger.Verbose($"Discovered Tentacle capabilities: {string.Join(",", tentacleCapabilities.SupportedCapabilities)}"); - - var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location); - logger.Verbose($"Tentacle Version: {fileVersionInfo.ProductVersion}"); // Check if we support any kubernetes script service. // It's implied (and tested) that GetCapabilities will only return Kubernetes or non-Kubernetes script services, never a mix diff --git a/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs b/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs index f65e7f116..d78ec113e 100644 --- a/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs +++ b/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs @@ -1,11 +1,14 @@ using System.Collections.Generic; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Octopus.Diagnostics; using Octopus.Tentacle.Contracts; using Octopus.Tentacle.Contracts.Capabilities; using Octopus.Tentacle.Contracts.KubernetesScriptServiceV1; using Octopus.Tentacle.Contracts.KubernetesScriptServiceV1Alpha; using Octopus.Tentacle.Contracts.ScriptServiceV2; +using Octopus.Tentacle.Properties; using Octopus.Tentacle.Util; namespace Octopus.Tentacle.Services.Capabilities @@ -13,10 +16,17 @@ namespace Octopus.Tentacle.Services.Capabilities [Service(typeof(ICapabilitiesServiceV2))] public class CapabilitiesServiceV2 : IAsyncCapabilitiesServiceV2 { + readonly ISystemLog log; + public CapabilitiesServiceV2(ISystemLog log) + { + this.log = log; + } public async Task GetCapabilitiesAsync(CancellationToken cancellationToken) { await Task.CompletedTask; - + + log.Verbose($"Tentacle Version: {OctopusTentacle.InformationalVersion}"); + //the kubernetes agent only supports the kubernetes script services if (PlatformDetection.Kubernetes.IsRunningAsKubernetesAgent) { From 944df323fa991ca143eca6a6a59a67cb61b2521e Mon Sep 17 00:00:00 2001 From: Samdanae Imran Date: Wed, 15 May 2024 13:17:41 +1200 Subject: [PATCH 3/5] Append version information to Capabilities Service --- .../Capabilities/CapabilitiesServiceV2.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs b/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs index d78ec113e..debd7c302 100644 --- a/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs +++ b/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs @@ -16,25 +16,20 @@ namespace Octopus.Tentacle.Services.Capabilities [Service(typeof(ICapabilitiesServiceV2))] public class CapabilitiesServiceV2 : IAsyncCapabilitiesServiceV2 { - readonly ISystemLog log; - public CapabilitiesServiceV2(ISystemLog log) - { - this.log = log; - } public async Task GetCapabilitiesAsync(CancellationToken cancellationToken) { await Task.CompletedTask; - - log.Verbose($"Tentacle Version: {OctopusTentacle.InformationalVersion}"); - + + var versionInformation = $"Tentacle_Version_{OctopusTentacle.InformationalVersion}"; + //the kubernetes agent only supports the kubernetes script services if (PlatformDetection.Kubernetes.IsRunningAsKubernetesAgent) { - return new CapabilitiesResponseV2(new List { nameof(IFileTransferService), nameof(IKubernetesScriptServiceV1Alpha), nameof(IKubernetesScriptServiceV1) }); + return new CapabilitiesResponseV2(new List { nameof(IFileTransferService), nameof(IKubernetesScriptServiceV1Alpha), nameof(IKubernetesScriptServiceV1), versionInformation }); } //non-kubernetes agent tentacles only support the standard script services - return new CapabilitiesResponseV2(new List { nameof(IScriptService), nameof(IFileTransferService), nameof(IScriptServiceV2) }); + return new CapabilitiesResponseV2(new List { nameof(IScriptService), nameof(IFileTransferService), nameof(IScriptServiceV2), versionInformation }); } } } \ No newline at end of file From f44510df55b8e6ceb6abbfaa8c6cd4f56fc2fb27 Mon Sep 17 00:00:00 2001 From: Samdanae Imran Date: Wed, 15 May 2024 13:20:25 +1200 Subject: [PATCH 4/5] Delete unnecessary imports --- .../Services/Capabilities/CapabilitiesServiceV2.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs b/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs index debd7c302..e8fa6fa27 100644 --- a/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs +++ b/source/Octopus.Tentacle/Services/Capabilities/CapabilitiesServiceV2.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; -using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Octopus.Diagnostics; using Octopus.Tentacle.Contracts; using Octopus.Tentacle.Contracts.Capabilities; using Octopus.Tentacle.Contracts.KubernetesScriptServiceV1; From 1f9cad6112ca28c17f7ced07e67e1cbd8d4f4e21 Mon Sep 17 00:00:00 2001 From: Samdanae Imran Date: Wed, 15 May 2024 13:21:09 +1200 Subject: [PATCH 5/5] Delete more unnecessary imports --- .../Scripts/ScriptOrchestratorFactory.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs b/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs index a115c0058..211db51f2 100644 --- a/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs +++ b/source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs @@ -1,6 +1,4 @@ using System; -using System.Diagnostics; -using System.Reflection; using System.Threading; using System.Threading.Tasks; using Halibut.ServiceModel;