-
Notifications
You must be signed in to change notification settings - Fork 450
/
Copy pathSettings.cs
358 lines (311 loc) · 15.5 KB
/
Settings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
namespace Build
{
public static class Settings
{
static Settings()
{
Directory.CreateDirectory(OutputDir);
}
private static string config(string @default = null, [CallerMemberName] string key = null)
{
var value = System.Environment.GetEnvironmentVariable(key);
return string.IsNullOrEmpty(value)
? @default
: value;
}
public const string DotnetIsolatedItemTemplatesVersion = "4.0.5051";
public const string DotnetIsolatedProjectTemplatesVersion = "4.0.5051";
public const string DotnetItemTemplatesVersion = "4.0.5051";
public const string DotnetProjectTemplatesVersion = "4.0.5051";
public const string TemplateJsonVersion = "3.1.1648";
public static readonly string SBOMManifestToolPath = Path.GetFullPath("../ManifestTool/Microsoft.ManifestTool.dll");
public static readonly string SrcProjectPath = Path.GetFullPath("../src/Cli/func/");
public static readonly string ConstantsFile = Path.Combine(SrcProjectPath, "Common", "Constants.cs");
public static readonly string TestProjectPath = Path.GetFullPath("../test/Azure.Functions.Cli.Tests/");
public static readonly string ProjectFile = Path.Combine(SrcProjectPath, "Azure.Functions.Cli.csproj");
public static readonly string TestProjectFile = Path.Combine(TestProjectPath, "Azure.Functions.Cli.Tests.csproj");
public static readonly string DurableFolder = Path.Combine(TestProjectPath, "Resources", "DurableTestFolder");
public static readonly string[] TargetRuntimes = new[] {
"min.win-arm64",
"min.win-x86",
"min.win-x64",
"linux-x64",
"osx-x64",
"osx-arm64",
"win-x86",
"win-x64",
"win-arm64" };
public static readonly Dictionary<string, string> RuntimesToOS = new Dictionary<string, string>
{
{ "win-x86", "WINDOWS" },
{ "win-x64", "WINDOWS" },
{ "win-arm64", "WINDOWS"},
{ "linux-x64", "LINUX" },
{ "osx-x64", "OSX" },
{ "osx-arm64", "OSX" },
{ "min.win-x86", "WINDOWS" },
{ "min.win-x64", "WINDOWS" },
{ "min.win-arm64", "WINDOWS"},
};
private static readonly string[] _winPowershellRuntimes = new[]
{
"win-x86",
"win",
"win10-x86",
"win8-x86",
"win81-x86",
"win7-x86",
"win-arm64",
"win-x64",
"win10-x64",
"win8-x64",
"win81-x64",
"win7-x64"
};
private static readonly string[] _winPowershellRuntimesNet8 = new[]
{
"win-x86",
"win",
"win-arm64",
"win-x64"
};
private static readonly string[] _linPowershellRuntimes = new[]
{
"linux",
"linux-x64",
"unix",
"linux-musl-x64"
};
private static readonly string[] _osxPowershellRuntimes = new[]
{
"osx",
"osx-x64",
"unix"
};
private static readonly string[] _osxARMPowershellRuntimes = new[]
{
"osx",
"osx-arm64",
"unix"
};
private static Dictionary<string, string[]> GetPowerShell72Runtimes()
{
var runtimes = new Dictionary<string, string[]>
{
{ "win-x86", _winPowershellRuntimes },
{ "win-x64", _winPowershellRuntimes },
{ "win-arm64", _winPowershellRuntimes },
{ "linux-x64", _linPowershellRuntimes },
{ "osx-x64", _osxPowershellRuntimes },
{ "osx-arm64", _osxARMPowershellRuntimes }
};
return runtimes;
}
private static Dictionary<string, string[]> GetPowerShell74Runtimes()
{
var runtimes = new Dictionary<string, string[]>
{
{ "win-x86", _winPowershellRuntimesNet8 },
{ "win-x64", _winPowershellRuntimesNet8 },
{ "win-arm64", _winPowershellRuntimesNet8 },
{ "linux-x64", _linPowershellRuntimes },
{ "osx-x64", _osxPowershellRuntimes },
{ "osx-arm64", _osxARMPowershellRuntimes }
};
return runtimes;
}
public static readonly Dictionary<string, Dictionary<string, string[]>> ToolsRuntimeToPowershellRuntimes = new Dictionary<string, Dictionary<string, string[]>>
{
{
"7",
new Dictionary<string, string[]>
{
{ "win-x86", _winPowershellRuntimes },
{ "win-x64", _winPowershellRuntimes },
{ "win-arm64", _winPowershellRuntimes },
{ "linux-x64", _linPowershellRuntimes },
{ "osx-x64", _osxPowershellRuntimes },
// NOTE: PowerShell 7.0 does not support arm. First version supporting it is 7.2
// https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.2#supported-versions
// That being said, we might as well include "osx" and "unix" since it'll hardly affect package size and should lead to more accurate error messages
{ "osx-arm64", new [] { "osx", "unix" } }
}
},
{
"7.2",
GetPowerShell72Runtimes()
},
{
"7.4",
GetPowerShell74Runtimes()
}
};
public static readonly string[] LanguageWorkers = new[] { "java", "powershell", "node", "python" };
public static string MinifiedVersionPrefix = "min.";
public const string DistLibVersion = "distlib-0.3.0";
public const string DistLibUrl = "https://github.com/vsajip/distlib/archive/0.3.0.zip";
public static readonly string OutputDir = Path.Combine(Path.GetFullPath(".."), "artifacts");
public static readonly string SBOMManifestTelemetryDir = Path.Combine(OutputDir, "SBOMManifestTelemetry");
public static string TargetFramework = "net6.0";
public static readonly string NupkgPublishDir = Path.GetFullPath($"../src/Azure.Functions.Cli/bin/Release/{TargetFramework}/publish");
public static readonly string PreSignTestDir = "PreSignTest";
public static readonly string SignTestDir = "SignTest";
public static readonly string DotnetIsolatedItemTemplates = $"https://www.nuget.org/api/v2/package/Microsoft.Azure.Functions.Worker.ItemTemplates/{DotnetIsolatedItemTemplatesVersion}";
public static readonly string DotnetIsolatedProjectTemplates = $"https://www.nuget.org/api/v2/package/Microsoft.Azure.Functions.Worker.ProjectTemplates/{DotnetIsolatedProjectTemplatesVersion}";
public static readonly string DotnetItemTemplates = $"https://www.nuget.org/api/v2/package/Microsoft.Azure.WebJobs.ItemTemplates/{DotnetItemTemplatesVersion}";
public static readonly string DotnetProjectTemplates = $"https://www.nuget.org/api/v2/package/Microsoft.Azure.WebJobs.ProjectTemplates/{DotnetProjectTemplatesVersion}";
public static readonly string TemplatesJsonZip = $"https://cdn.functions.azure.com/public/TemplatesApi/{TemplateJsonVersion}.zip";
public static readonly string TelemetryKeyToReplace = "00000000-0000-0000-0000-000000000000";
public static string BuildNumber => config("9999", "devops_buildNumber");
public static string IntegrationBuildNumber => config(null, "integrationBuildNumber") ?? string.Empty;
public static string CommitId => config("N/A", "Build.SourceVersion");
public static string TelemetryInstrumentationKey => config(null, "TELEMETRY_INSTRUMENTATION_KEY");
public static bool IsPublicBuild => string.Equals(config(null, "IsPublicBuild"), true.ToString(), System.StringComparison.OrdinalIgnoreCase);
public static string BuildArtifactsStorage => config(null);
public class SignInfo
{
public static string AzureSigningConnectionString => config(null, "AzureBlobSigningConnectionString");
public static readonly string AzureToSignContainerName = "azure-functions-cli";
public static readonly string AzureSignedContainerName = "azure-functions-cli-signed";
public static readonly string AzureSigningJobName = "signing-jobs";
public static readonly string ToSignZipName = $"{BuildNumber}-authenticode.zip";
public static readonly string ToSignThirdPartyName = $"{BuildNumber}-third.zip";
public static readonly string ToSignDir = "ToSign";
public static readonly string SignedDir = "signed";
public static readonly string Authenticode = "SignAuthenticode";
public static readonly string ToAuthenticodeSign = "Authenticode";
public static readonly string ThirdParty = "Sign3rdParty";
public static readonly string ToThirdPartySign = "ThirdParty";
public static readonly string ToMacSign = "Mac";
public static readonly string[] RuntimesToSign = new string[] { "min.win-arm64", "min.win-x86", "min.win-x64", "osx-arm64", "osx-x64" };
public static readonly string[] FilterExtensionsSign = new[] { ".json", "json.sha256", ".spec", ".cfg", ".pdb", ".config", ".nupkg", ".py", ".md" };
public static readonly string SigcheckDownloadURL = "https://functionsbay.blob.core.windows.net/public/tools/sigcheck64.exe";
public static readonly string[] SkipSigcheckTest = new[] {
"aspnetcorev2_inprocess.dll",
"Microsoft.AspNetCore.Buffering.dll",
"Microsoft.AspNetCore.Server.IIS.dll"
};
public static readonly string[] macBinaries = new[] {
"func",
"gozip"
};
public static readonly string[] authentiCodeBinaries = new[] {
"DurableTask.AzureStorage.Internal.dll",
"DurableTask.Core.Internal.dll",
"func.dll",
"func.exe",
"gozip.exe",
"func.pdb",
"Microsoft.Azure.AppService.*",
"Microsoft.Azure.WebJobs.*",
"Microsoft.Azure.WebSites.DataProtection.dll",
"Azure.Core.dll",
"Azure.Identity.dll",
"Azure.Storage.Blobs.dll",
"Azure.Storage.Common.dll",
"Microsoft.Extensions.Azure.dll",
"Microsoft.Identity.Client.dll",
"Microsoft.Identity.Client.Extensions.Msal.dll",
Path.Combine("workers", "python")
};
public static readonly string[] thirdPartyBinaries = new[] {
"AccentedCommandLineParser.dll",
"Autofac.dll",
"Azure.Security.KeyVault.*",
"BouncyCastle.Crypto.dll",
"Colors.Net.dll",
"DotNetZip.dll",
"Dynamitey.dll",
"Google.Protobuf.dll",
"Grpc.AspNetCore.Server.ClientFactory.dll",
"Grpc.AspNetCore.Server.dll",
"Grpc.Core.dll",
"Grpc.Core.Api.dll",
"Grpc.Net.Client.dll",
"Grpc.Net.ClientFactory.dll",
"Grpc.Net.Common.dll",
"grpc_csharp_ext.x64.dll",
"grpc_csharp_ext.x86.dll",
"HTTPlease.Core.dll",
"HTTPlease.Diagnostics.dll",
"HTTPlease.Formatters.dll",
"HTTPlease.Formatters.Json.dll",
"ImpromptuInterface.dll",
"KubeClient.dll",
"KubeClient.Extensions.KubeConfig.dll",
"NCrontab.Signed.dll",
"Newtonsoft.Json.Bson.dll",
"Newtonsoft.Json.dll",
"protobuf-net.dll",
"Remotion.Linq.dll",
"System.IO.Abstractions.dll",
"dotnet-aspnet-codegenerator-design.dll",
"DotNetTI.BreakingChangeAnalysis.dll",
"Microsoft.Azure.KeyVault.*",
"Microsoft.AI.*.dll",
"Microsoft.Build.Framework.dll",
"Microsoft.Build.dll",
"Microsoft.CodeAnalysis.dll",
"Microsoft.CodeAnalysis.CSharp.dll",
"Microsoft.CodeAnalysis.CSharp.Scripting.dll",
"Microsoft.CodeAnalysis.CSharp.Workspaces.dll",
"Microsoft.CodeAnalysis.Razor.dll",
"Microsoft.CodeAnalysis.Scripting.dll",
"Microsoft.CodeAnalysis.VisualBasic.dll",
"Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll",
"Microsoft.CodeAnalysis.Workspaces.dll",
"Microsoft.DotNet.PlatformAbstractions.dll",
"Microsoft.Extensions.DependencyModel.dll",
"Microsoft.Extensions.DiagnosticAdapter.dll",
"Microsoft.Extensions.Logging.ApplicationInsights.dll",
"Microsoft.Extensions.PlatformAbstractions.dll",
"Microsoft.Azure.Services.AppAuthentication.dll",
"Microsoft.IdentityModel.*",
"Microsoft.ApplicationInsights.*",
"Microsoft.Rest.ClientRuntime.*",
"Microsoft.VisualStudio.Web.CodeGenera*",
"Microsoft.WindowsAzure.Storage.dll",
"Microsoft.AspNetCore.*",
"NuGet.*.dll",
"protobuf-net.Core.dll",
"System.Composition.*",
"System.Configuration.ConfigurationManager.dll",
"System.Data.SqlClient.dll",
"System.Diagnostics.PerformanceCounter.dll",
"System.IdentityModel.Tokens.Jwt.dll",
"System.Interactive.Async.dll",
"System.Memory.Data.dll",
"System.Net.Http.Formatting.dll",
"System.Private.ServiceModel.dll",
"System.Reactive.*.dll",
"System.Security.Cryptography.ProtectedData.dll",
"YamlDotNet.dll",
"Marklio.Metadata.dll",
"Microsoft.Azure.Cosmos.Table.dll",
"Microsoft.Azure.DocumentDB.Core.dll",
"Microsoft.Azure.Storage.Blob.dll",
"Microsoft.Azure.Storage.Common.dll",
"Microsoft.Azure.Storage.File.dll",
"Microsoft.Azure.Storage.Queue.dll",
"Microsoft.OData.Core.dll",
"Microsoft.OData.Edm.dll",
"Microsoft.Spatial.dll",
"Mono.Posix.NETStandard.dll",
"OpenTelemetry.Api.dll",
"OpenTelemetry.Api.ProviderBuilderExtensions.dll",
"OpenTelemetry.dll",
"OpenTelemetry.Exporter.Console.dll",
"OpenTelemetry.Exporter.OpenTelemetryProtocol.dll",
"OpenTelemetry.Extensions.Hosting.dll",
"OpenTelemetry.Instrumentation.AspNetCore.dll",
"OpenTelemetry.Instrumentation.Http.dll",
"OpenTelemetry.PersistentStorage.Abstractions.dll",
"OpenTelemetry.PersistentStorage.FileSystem.dll",
Path.Combine("tools", "python", "packapp", "distlib")
};
}
}
}