diff --git a/source/Calamari/Calamari.csproj b/source/Calamari/Calamari.csproj
index e52ff06..4d790d3 100644
--- a/source/Calamari/Calamari.csproj
+++ b/source/Calamari/Calamari.csproj
@@ -15,8 +15,8 @@
netcoreapp3.1
-
-
+
+
diff --git a/source/Sashimi.Tests/AzureActionHandlerExtensionsFixture.cs b/source/Sashimi.Tests/AzureActionHandlerExtensionsFixture.cs
index 6bd646a..02cb471 100644
--- a/source/Sashimi.Tests/AzureActionHandlerExtensionsFixture.cs
+++ b/source/Sashimi.Tests/AzureActionHandlerExtensionsFixture.cs
@@ -1,6 +1,7 @@
using System;
using NSubstitute;
using NUnit.Framework;
+using Octopus.Server.Extensibility.HostServices.Diagnostics;
using Sashimi.Server.Contracts.ActionHandlers;
using Sashimi.Server.Contracts.CommandBuilders;
using Sashimi.Tests.Shared.Server;
@@ -20,7 +21,7 @@ public void AzureCmdletsToolAddedWhenBundledModulesTrue()
variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModules, Boolean.TrueString);
context.Variables.Returns(variables);
- builder.WithAzureTools(context);
+ builder.WithAzureTools(context, Substitute.For());
builder.Received().WithTool(AzureTools.AzureCmdlets);
}
@@ -34,7 +35,7 @@ public void AzureCmdletsToolExcludedWhenBundledModulesFalse()
variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModules, Boolean.FalseString);
context.Variables.Returns(variables);
- builder.WithAzureTools(context);
+ builder.WithAzureTools(context, Substitute.For());
builder.DidNotReceive().WithTool(AzureTools.AzureCmdlets);
}
@@ -48,7 +49,7 @@ public void AzureCmdletsToolAddedWhenLegacyVariableIsTrue()
variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModulesLegacy, Boolean.TrueString);
context.Variables.Returns(variables);
- builder.WithAzureTools(context);
+ builder.WithAzureTools(context, Substitute.For());
builder.Received().WithTool(AzureTools.AzureCmdlets);
}
@@ -62,7 +63,7 @@ public void AzureCmdletsToolExcludedWhenLegacyVariableIsFalse()
variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModulesLegacy, Boolean.FalseString);
context.Variables.Returns(variables);
- builder.WithAzureTools(context);
+ builder.WithAzureTools(context, Substitute.For());
builder.DidNotReceive().WithTool(AzureTools.AzureCmdlets);
}
@@ -77,7 +78,7 @@ public void AzureCmdletsWillIgnoreLegacyVariableWhenBundledModulesFalse()
variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModules, Boolean.FalseString);
context.Variables.Returns(variables);
- builder.WithAzureTools(context);
+ builder.WithAzureTools(context, Substitute.For());
builder.DidNotReceive().WithTool(AzureTools.AzureCmdlets);
}
@@ -92,7 +93,7 @@ public void AzureCmdletsWillIgnoreLegacyVariableWhenBundledModulesTrueAndLegacyI
variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModules, Boolean.TrueString);
context.Variables.Returns(variables);
- builder.WithAzureTools(context);
+ builder.WithAzureTools(context, Substitute.For());
builder.Received().WithTool(AzureTools.AzureCmdlets);
}
@@ -107,7 +108,7 @@ public void AzureCmdletsWillNotBeAddedWhenLegacyAndBundledModulesSetToFalse()
variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModules, Boolean.FalseString);
context.Variables.Returns(variables);
- builder.WithAzureTools(context);
+ builder.WithAzureTools(context, Substitute.For());
builder.DidNotReceive().WithTool(AzureTools.AzureCmdlets);
}
}
diff --git a/source/Sashimi.Tests/Sashimi.Tests.csproj b/source/Sashimi.Tests/Sashimi.Tests.csproj
index 2f2717c..dd2d208 100644
--- a/source/Sashimi.Tests/Sashimi.Tests.csproj
+++ b/source/Sashimi.Tests/Sashimi.Tests.csproj
@@ -15,8 +15,8 @@
-
-
+
+
diff --git a/source/Sashimi/AzureActionHandlerExtensions.cs b/source/Sashimi/AzureActionHandlerExtensions.cs
index 3b60e38..dc7aa52 100644
--- a/source/Sashimi/AzureActionHandlerExtensions.cs
+++ b/source/Sashimi/AzureActionHandlerExtensions.cs
@@ -1,8 +1,8 @@
using System;
+using Octopus.Server.Extensibility.HostServices.Diagnostics;
using Sashimi.Azure.Accounts;
using Sashimi.Server.Contracts;
using Sashimi.Server.Contracts.ActionHandlers;
-using Sashimi.Server.Contracts.Calamari;
using Sashimi.Server.Contracts.CommandBuilders;
namespace Sashimi.AzureScripting
@@ -11,16 +11,17 @@ public static class AzureActionHandlerExtensions
{
public static ICalamariCommandBuilder WithAzureTools(
this ICalamariCommandBuilder builder,
- IActionHandlerContext context)
+ IActionHandlerContext context,
+ ITaskLog taskLog)
{
- return builder.WithAzureCmdlets(context).WithAzureCLI(context);
+ return builder.WithAzureCmdlets(context, taskLog).WithAzureCLI(context, taskLog);
}
- public static ICalamariCommandBuilder WithCheckAccountIsNotManagementCertificate(this ICalamariCommandBuilder builder, IActionHandlerContext context)
+ public static ICalamariCommandBuilder WithCheckAccountIsNotManagementCertificate(this ICalamariCommandBuilder builder, IActionHandlerContext context, ITaskLog taskLog)
{
if (context.Variables.Get(SpecialVariables.AccountType) != AccountTypes.AzureServicePrincipalAccountType.ToString())
{
- context.Log.Warn("Azure have announced they will be retiring Service Management API support on June 30th 2018. Please switch to using Service Principals for your Octopus Azure accounts https://g.octopushq.com/AzureServicePrincipalAccount");
+ taskLog.Warn("Azure have announced they will be retiring Service Management API support on June 30th 2018. Please switch to using Service Principals for your Octopus Azure accounts https://g.octopushq.com/AzureServicePrincipalAccount");
}
return builder;
@@ -28,7 +29,8 @@ public static ICalamariCommandBuilder WithCheckAccountIsNotManagementCertificate
public static ICalamariCommandBuilder WithAzureCmdlets(
this ICalamariCommandBuilder builder,
- IActionHandlerContext context)
+ IActionHandlerContext context,
+ ITaskLog taskLog)
{
// This is the new value that the user can set on the step. It and the legacy variable both default to true, if either are false then
// we don't include the tooling.
@@ -39,7 +41,7 @@ public static ICalamariCommandBuilder WithAzureCmdlets(
if (legacyModuleBundling == false)
{
// user has explicitly used the legacy flag to switch off bundling, tell them it's available on the step now
- context.Log.Warn($"The {SpecialVariables.Action.Azure.UseBundledAzureModules} variable has been used to disable using the bundled Azure PowerShell modules. Note that this variable is deprecated and will be removed in a future version, please use the bundling options on the step to control this behavior now.");
+ taskLog.Warn($"The {SpecialVariables.Action.Azure.UseBundledAzureModules} variable has been used to disable using the bundled Azure PowerShell modules. Note that this variable is deprecated and will be removed in a future version, please use the bundling options on the step to control this behavior now.");
}
if (useBundledTooling && legacyModuleBundling)
@@ -50,7 +52,8 @@ public static ICalamariCommandBuilder WithAzureCmdlets(
public static ICalamariCommandBuilder WithAzureCLI(
this ICalamariCommandBuilder builder,
- IActionHandlerContext context)
+ IActionHandlerContext context,
+ ITaskLog taskLog)
{
// This is the new value that the user can set on the step. It and the legacy variable both default to true, if either are false then
// we don't include the tooling.
@@ -61,7 +64,7 @@ public static ICalamariCommandBuilder WithAzureCLI(
if (legacyCliBundling == false)
{
// user has explicitly used the legacy flag to switch off bundling, tell them it's available on the step now
- context.Log.Warn($"The {SpecialVariables.Action.Azure.UseBundledAzureCLI} variable has been used to disable using the bundled Azure CLI. Note that this variable is deprecated and will be removed in a future version, please use the bundling options on the step to control this behavior now.");
+ taskLog.Warn($"The {SpecialVariables.Action.Azure.UseBundledAzureCLI} variable has been used to disable using the bundled Azure CLI. Note that this variable is deprecated and will be removed in a future version, please use the bundling options on the step to control this behavior now.");
}
if (useBundledTooling && legacyCliBundling)
diff --git a/source/Sashimi/AzurePowerShellActionHandler.cs b/source/Sashimi/AzurePowerShellActionHandler.cs
index d4bf65e..2c90d0e 100644
--- a/source/Sashimi/AzurePowerShellActionHandler.cs
+++ b/source/Sashimi/AzurePowerShellActionHandler.cs
@@ -1,4 +1,5 @@
using System;
+using Octopus.Server.Extensibility.HostServices.Diagnostics;
using Sashimi.Server.Contracts;
using Sashimi.Server.Contracts.ActionHandlers;
@@ -16,15 +17,15 @@ public class AzurePowerShellActionHandler : IActionHandlerWithAccount
public ActionHandlerCategory[] Categories => new[] { ActionHandlerCategory.BuiltInStep, AzureConstants.AzureActionHandlerCategory, ActionHandlerCategory.Script };
public string[] StepBasedVariableNameForAccountIds { get; } = {SpecialVariables.Action.Azure.AccountId};
- public IActionHandlerResult Execute(IActionHandlerContext context)
+ public IActionHandlerResult Execute(IActionHandlerContext context, ITaskLog taskLog)
{
var syntax = context.Variables.GetEnum(KnownVariables.Action.Script.Syntax, ScriptSyntax.PowerShell);
var builder = context.CalamariCommand(AzureConstants.CalamariAzure, "run-script")
- .WithAzureCLI(context);
+ .WithAzureCLI(context, taskLog);
if (syntax == ScriptSyntax.PowerShell)
- builder = builder.WithAzureCmdlets(context);
+ builder = builder.WithAzureCmdlets(context, taskLog);
var isInPackage = KnownVariableValues.Action.Script.ScriptSource.Package.Equals(context.Variables.Get(KnownVariables.Action.Script.ScriptSource), StringComparison.OrdinalIgnoreCase);
if (isInPackage)
@@ -32,7 +33,7 @@ public IActionHandlerResult Execute(IActionHandlerContext context)
builder.WithStagedPackageArgument();
}
- return builder.Execute();
+ return builder.Execute(taskLog);
}
}
}
\ No newline at end of file
diff --git a/source/Sashimi/Sashimi.csproj b/source/Sashimi/Sashimi.csproj
index 2f9159a..f168e25 100644
--- a/source/Sashimi/Sashimi.csproj
+++ b/source/Sashimi/Sashimi.csproj
@@ -21,9 +21,9 @@
-
-
-
+
+
+