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
3 changes: 2 additions & 1 deletion source/Octopus.Tentacle/Octopus.Tentacle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="4.6.2" />
<PackageReference Include="NuGet.Packaging" Version="3.6.0-octopus-58692" />
<PackageReference Include="NuGet.Packaging" Version="6.14.1-release.3901" />
<PackageReference Include="Octopus.Time" Version="1.1.339" />
<PackageReference Include="Octopus.Versioning" Version="5.1.883" />
<PackageReference Include="TaskScheduler" Version="2.7.2" />
<PackageReference Include="Nito.AsyncEx" Version="5.0.0" />
<PackageReference Include="NLog" Version="5.0.4" />
Expand Down
22 changes: 18 additions & 4 deletions source/Octopus.Tentacle/Packages/NuGetPackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,24 @@ public int Install(string packageFile, string directory, ILog log, bool suppress

public int Install(Stream packageStream, string directory, ILog log, bool suppressNestedScriptWarning)
{
var extracted = PackageExtractor.ExtractPackage(packageStream,
new SuppliedDirectoryPackagePathResolver(directory),
new PackageExtractionContext(NullLogger.Instance) { PackageSaveMode = PackageSaveMode.Files, XmlDocFileSaveMode = XmlDocFileSaveMode.None, CopySatelliteFiles = false },
CancellationToken.None);
// The 'source' parameter is used for logging/tracking purposes in NuGet's new API.
// It can be null or any string identifier. We use null here as we don't need tracking.
// Signature verification is bypassed by passing null for ClientPolicyContext (3rd param in PackageExtractionContext).
var extracted = PackageExtractor.ExtractPackageAsync(
null, // source - not needed for our use case and can be null because ClientPolicyContext is null.
packageStream,
new SuppliedDirectoryPackagePathResolver(directory),
new PackageExtractionContext(
PackageSaveMode.Files,
XmlDocFileSaveMode.None,
null, // ClientPolicyContext - null bypasses signature verification
NullLogger.Instance)
{
CopySatelliteFiles = false
},
CancellationToken.None)
.GetAwaiter()
.GetResult();

return extracted.Count();
}
Expand Down
7 changes: 3 additions & 4 deletions source/Octopus.Tentacle/Properties/OctopusTentacle.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using System.Reflection;
using Octopus.Client.Model;
using Octopus.Tentacle.Util;
using Octopus.Tentacle.Versioning;
using AssemblyExtensions = Octopus.Tentacle.Versioning.AssemblyExtensions;
using Octopus.Versioning.Semver;

namespace Octopus.Tentacle.Properties
{
public static class OctopusTentacle
{
public static readonly Assembly Assembly = typeof (OctopusTentacle).Assembly;
public static readonly string InformationalVersion = Assembly.GetInformationalVersion() ?? "0.0.0";
public static readonly SemanticVersionInfo SemanticVersionInfo = new SemanticVersionInfo(Assembly);
public static readonly SemanticVersion Version = new SemanticVersion(SemanticVersionInfo.NuGetVersion);
public static readonly SemanticVersionInfo SemanticVersionInfo = new(Assembly);
public static readonly SemanticVersion Version = SemanticVersionInfo.SemanticVersion;
public static readonly string[] EnvironmentInformation = EnvironmentHelper.SafelyGetEnvironmentInformation();
}
}
5 changes: 3 additions & 2 deletions source/Octopus.Tentacle/Versioning/SemanticVersionInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Reflection;
using NuGet.Versioning;
using Octopus.Versioning;
using Octopus.Versioning.Semver;

namespace Octopus.Tentacle.Versioning
{
Expand All @@ -11,7 +12,7 @@ public class SemanticVersionInfo
{
public SemanticVersionInfo(Assembly assembly)
{
SemanticVersion = SemanticVersion.Parse(assembly.GetInformationalVersion() ?? "0.0.0");
SemanticVersion = SemVerFactory.Parse(assembly.GetInformationalVersion() ?? "0.0.0");
MajorMinorPatch = SemanticVersion.ToString("V", new VersionFormatter());
BranchName = assembly.GetCustomAttribute<AssemblyGitBranchAttribute>()!.BranchName;
NuGetVersion = assembly.GetCustomAttribute<AssemblyNuGetVersionAttribute>()!.NuGetVersion;
Expand Down