Skip to content

Release/v3.x #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 36 commits into
base: v3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a08dbc1
Updating bundle build to include templates v2
soninaren Aug 9, 2023
8ffb202
Updated bundle version to 3.27.0, template version to 3.0.2727 (#296)
azfuncgh Aug 10, 2023
9bcdc40
Updated bundle version to 3.28.0, template version to 3.0.2771 (#300)
azfuncgh Sep 12, 2023
5da4d3d
Create CODEOWNERS
fabiocav Oct 2, 2023
7199c2d
[v3.x] Added test to validate that bundles updates do not move depend…
surgupta-msft Nov 7, 2023
5b2bf5e
Disable test (#322)
surgupta-msft Nov 7, 2023
78996ef
[v3.x] Tests updated to validate only major version changes (#326)
surgupta-msft Nov 8, 2023
97e8de5
Prepare bundles 3.29.0 (DF hotfix for version 2.11.3) (#328)
davidmrdavid Nov 10, 2023
363b617
Updated bundle version to 3.29.0 (for hotfix) (#330)
azfuncgh Nov 10, 2023
265d7a1
Updated bundle version to 3.30.0, template version to 3.0.2924 (#334)
azfuncgh Dec 12, 2023
5fc386a
reverting the hard coded extension versions (#338)
soninaren Jan 11, 2024
b977a60
Updated bundle version to 3.30.1, template version to 3.0.2937 (#346)
azfuncgh Jan 16, 2024
14302ba
Updated bundle version to 3.31.0, template version to 3.0.2957 (#351)
azfuncgh Feb 6, 2024
c8c0906
ping DF extension to 2.12.0 (#354)
davidmrdavid Feb 9, 2024
cecb37f
Updated bundle version to 3.30.2, template version to 3.0.2964 (#358)
azfuncgh Feb 12, 2024
cf9c0ef
checking for vulnureable packages (#314) (#361)
soninaren Feb 22, 2024
02fe256
Updated bundle version to 3.32.0, template version to 3.0.2964 (#369)
azfuncgh Mar 13, 2024
d9783a5
Pin Azure.Identity to 1.11.0 (v3.x) (#381)
jviau Apr 15, 2024
bd201f9
Remove Azure.Identity from csproj, use extensions.json (#382)
jviau Apr 16, 2024
b95d526
unpin DF packages (#374)
davidmrdavid Apr 17, 2024
8772dd4
Pin Microsoft.Identity.Client to 4.60.3 (#387)
kshyju Apr 22, 2024
4c967cb
Updated bundle version to 3.33.0, template version to 3.0.3022 (#394)
azfuncgh Apr 30, 2024
5750b75
adding compression to RU package (#398)
soninaren May 2, 2024
4d31193
Fixing build failures (#411)
soninaren Jul 2, 2024
5ae438c
Updated bundle version to 3.34.0, template version to 3.0.3043 (#413)
azfuncgh Jul 3, 2024
9412d10
adding code-mirror.yml
soninaren Jul 17, 2024
6f5b853
Build migration for 1ES
soninaren Aug 27, 2024
9363bf2
Fixing build failures
soninaren Aug 29, 2024
6fa3a8d
Download templates from template build artifacts
soninaren Aug 28, 2024
f8924da
Adding linux build
soninaren Aug 30, 2024
635395a
Updated bundle version to 3.35.0 (#431)
azfuncgh Sep 5, 2024
dad61a2
Setting up public build with parameters
soninaren Sep 5, 2024
af535da
Adding pool name parameter
soninaren Sep 6, 2024
27250e7
fixing the pool name for public build
soninaren Sep 6, 2024
465dd31
V3 build fixes (#439)
gavin-aguiar Oct 31, 2024
5582962
Updated bundle version to 3.36.0 (#446)
azfuncgh Nov 1, 2024
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
8 changes: 8 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://help.github.com/articles/about-codeowners/
# for more info about CODEOWNERS file
#
# It uses the same pattern rule for gitignore file
# https://git-scm.com/docs/gitignore#_pattern_format
#

* @azure/azure-functions-extensions-bundle-admins
203 changes: 203 additions & 0 deletions ExtensionBundle.Tests/DependencyValidationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Build;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Extensions.DependencyModel;
using Xunit;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;

namespace Microsoft.Azure.Functions.ExtensionBundle.Tests
{
[Collection("Fixture")]
public class DependencyValidationTests
{
private readonly DependencyContextJsonReader _reader = new DependencyContextJsonReader();
private readonly IEnumerable<string> _rids = DependencyHelper.GetRuntimeFallbacks();
private readonly Fixture _fixture;

public DependencyValidationTests(Fixture fixture)
{
_fixture = fixture;
}

[InlineData("any_any_extensions.deps.json", "NetCoreApp3_any_any")]
[InlineData("win_x86_extensions.deps.json", "x86")]
[InlineData("win_x64_extensions.deps.json", "x64")]
[Theory]
public void Verify_DepsJsonChanges(string oldDepsJsonName, string newDepsJsonName)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return;
}

string oldDepsJson = Path.GetFullPath($"../../../TestData/{oldDepsJsonName}");
string webhostBinPath = Path.Combine("..", "..", "..", "..", "build_temp");
string newDepsJson = Directory.GetFiles(Path.GetFullPath(webhostBinPath), "extensions.deps.json", SearchOption.AllDirectories)
.Where(path => path.Contains(newDepsJsonName))
.FirstOrDefault();

Assert.True(File.Exists(oldDepsJson), $"{oldDepsJson} not found.");
Assert.True(File.Exists(newDepsJson), $"{newDepsJson} not found.");

(bool succeed, string output) = CompareDepsJsonFiles(oldDepsJson, newDepsJson);

if (succeed == true)
{
return;
}

Assert.True(succeed, output);
}

[Fact]
public void Verify_DepsJsonChanges_Linux_X64()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}

string oldDepsJson = Path.GetFullPath("../../../TestData/linux_x64_extensions.deps.json");
string webhostBinPath = Path.Combine("..", "..", "..", "..", "build_temp");
string newDepsJson = Directory.GetFiles(Path.GetFullPath(webhostBinPath), "extensions.deps.json", SearchOption.AllDirectories)
.Where(path => path.Contains("x64"))
.FirstOrDefault();

Assert.True(File.Exists(oldDepsJson), $"{oldDepsJson} not found.");
Assert.True(File.Exists(newDepsJson), $"{newDepsJson} not found.");

(bool succeed, string output) = CompareDepsJsonFiles(oldDepsJson, newDepsJson);

if (succeed == true)
{
return;
}

Assert.True(succeed, output);
}


private (bool, string) CompareDepsJsonFiles(string oldDepsJson, string newDepsJson)
{
IEnumerable<RuntimeFile> oldAssets = GetRuntimeFiles(oldDepsJson);
IEnumerable<RuntimeFile> newAssets = GetRuntimeFiles(newDepsJson);

var comparer = new RuntimeFileComparer();
var assemblyToIgnore = "extensions.dll";

var removed = oldAssets.Except(newAssets, comparer).ToList();
removed = removed.Where(f => !(f.Path.Contains(assemblyToIgnore) && f.AssemblyVersion == null)).ToList();

var added = newAssets.Except(oldAssets, comparer).ToList();
added = added.Where(f => !(f.Path.Contains(assemblyToIgnore) && f.AssemblyVersion == null)).ToList();

bool succeed = removed.Count == 0 && added.Count == 0;

if (succeed)
{
return (succeed, null);
}

IList<RuntimeFile> changed = new List<RuntimeFile>();
StringBuilder sb = new StringBuilder();
sb.AppendLine("IMPORTANT: The dependencies in extensions have changed and MUST be reviewed before proceeding. Please follow up with brettsam, fabiocav, nasoni or mathewc for approval.");
sb.AppendLine();
sb.AppendLine($"Previous file: {oldDepsJson}");
sb.AppendLine($"New file: {newDepsJson}");
sb.AppendLine();
sb.AppendLine(" Changed:");
foreach (RuntimeFile oldFile in oldAssets)
{
string fileName = Path.GetFileName(oldFile.Path);

var newFile = newAssets.SingleOrDefault(p =>
{
return Path.GetFileName(p.Path) == fileName
&& Version.TryParse(p.AssemblyVersion, out Version newVersion)
&& Version.TryParse(oldFile.AssemblyVersion, out Version oldVersion)
&& newVersion.Major != oldVersion.Major;
});

if (newFile != null)
{
sb.AppendLine($" - {fileName}: {oldFile.AssemblyVersion}/{oldFile.FileVersion} -> {newFile.AssemblyVersion}/{newFile.FileVersion}");
changed.Add(oldFile);
changed.Add(newFile);
}
}

sb.AppendLine();
sb.AppendLine(" Removed:");
foreach (RuntimeFile f in removed.Except(changed))
{
sb.AppendLine($" - {Path.GetFileName(f.Path)}: {f.AssemblyVersion}/{f.FileVersion}");
}
sb.AppendLine();
sb.AppendLine(" Added:");
foreach (RuntimeFile f in added.Except(changed))
{
sb.AppendLine($" - {Path.GetFileName(f.Path)}: {f.AssemblyVersion}/{f.FileVersion}");
}

return (succeed, sb.ToString());
}

private IEnumerable<RuntimeFile> GetRuntimeFiles(string depsJsonFileName)
{
using (Stream s = new FileStream(depsJsonFileName, FileMode.Open))
{
DependencyContext deps = _reader.Read(s);

return deps.RuntimeLibraries
.SelectMany(l => SelectRuntimeAssemblyGroup(_rids, l.RuntimeAssemblyGroups))
.OrderBy(p => Path.GetFileName(p.Path));
}
}

private static IEnumerable<RuntimeFile> SelectRuntimeAssemblyGroup(IEnumerable<string> rids, IReadOnlyList<RuntimeAssetGroup> runtimeAssemblyGroups)
{
// Attempt to load group for the current RID graph
foreach (var rid in rids)
{
var assemblyGroup = runtimeAssemblyGroups.FirstOrDefault(g => string.Equals(g.Runtime, rid, StringComparison.OrdinalIgnoreCase));
if (assemblyGroup != null)
{
return assemblyGroup.RuntimeFiles;
}
}

// If unsuccessful, load default assets, making sure the path is flattened to reflect deployed files
return runtimeAssemblyGroups.GetDefaultRuntimeFileAssets();
}


private class RuntimeFileComparer : IEqualityComparer<RuntimeFile>
{
public bool Equals([AllowNull] RuntimeFile x, [AllowNull] RuntimeFile y)
{
return Version.TryParse(x.AssemblyVersion, out Version xVersion)
&& Version.TryParse(y.AssemblyVersion, out Version yVersion)
&& xVersion.Major == yVersion.Major;
}

public int GetHashCode([DisallowNull] RuntimeFile obj)
{
Version.TryParse(obj.AssemblyVersion, out Version objVersion);
if (objVersion != null)
{
string code = objVersion.Major.ToString();
return code.GetHashCode();
}

return 0;
}
}
}
}
24 changes: 24 additions & 0 deletions ExtensionBundle.Tests/ExtensionBundle.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Microsoft.Azure.Functions.ExtensionBundle.Tests</AssemblyName>
<RootNamespace>Microsoft.Azure.Functions.ExtensionBundle.Tests</RootNamespace>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\build\Build.csproj" />
</ItemGroup>

</Project>
35 changes: 35 additions & 0 deletions ExtensionBundle.Tests/Fixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Build;
using System.Runtime.InteropServices;
using Xunit;
using static Build.BasePath;

namespace Microsoft.Azure.Functions.ExtensionBundle.Tests
{
public class Fixture
{
public Fixture()
{
path = "../../../..";

BuildSteps.Clean();

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
BuildSteps.BuildBundleBinariesForLinux();
}
else
{
BuildSteps.BuildBundleBinariesForWindows();
}

}
}

[CollectionDefinition("Fixture")]
public class TestFixture : ICollectionFixture<Fixture>
{
// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition] and all the
// ICollectionFixture<> interfaces.
}
}
Loading