-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2257 from Azure/dev
- Loading branch information
Showing
76 changed files
with
1,898 additions
and
169 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
trigger: none | ||
pr: none | ||
|
||
pool: | ||
name: '1ES-Hosted-DurableTaskFramework' | ||
demands: | ||
- ImageOverride -equals MMS2022TLS | ||
|
||
steps: | ||
|
||
# Configure all the .NET SDK versions we need | ||
- task: UseDotNet@2 | ||
displayName: 'Use the .NET Core 2.1 SDK (required for build signing)' | ||
inputs: | ||
packageType: 'sdk' | ||
version: '2.1.x' | ||
|
||
- task: UseDotNet@2 | ||
displayName: 'Use the .NET Core 3.1 SDK' | ||
inputs: | ||
packageType: 'sdk' | ||
version: '3.1.x' | ||
|
||
- task: UseDotNet@2 | ||
displayName: 'Use the .NET 6 SDK' | ||
inputs: | ||
packageType: 'sdk' | ||
version: '6.0.x' | ||
|
||
# Use NuGet | ||
- task: NuGetToolInstaller@1 | ||
displayName: 'Use NuGet ' | ||
|
||
# dotnet restore | ||
- task: DotNetCoreCLI@2 | ||
displayName: 'dotnet restore' | ||
inputs: | ||
command: restore | ||
projects: '**/**/*.csproj' | ||
feedsToUse: config | ||
nugetConfigPath: '.nuget/nuget.config' | ||
|
||
# Build durable-analyzer | ||
- task: VSBuild@1 | ||
displayName: 'Build Durable Analyzer' | ||
inputs: | ||
solution: '**/WebJobs.Extensions.DurableTask.Analyzers.sln' | ||
vsVersion: "16.0" | ||
configuration: Release | ||
|
||
# Authenticode sign all the DLLs with the Microsoft certificate. | ||
- task: EsrpCodeSigning@1 | ||
inputs: | ||
ConnectedServiceName: 'ESRP Service' | ||
FolderPath: 'src/WebJobs.Extensions.DurableTask.Analyzers/bin/Release' | ||
Pattern: '*DurableTask.Analyzers.dll' | ||
signConfigType: 'inlineSignParams' | ||
inlineOperation: | | ||
[ | ||
{ | ||
"KeyCode": "CP-230012", | ||
"OperationCode": "SigntoolSign", | ||
"Parameters": { | ||
"OpusName": "Microsoft", | ||
"OpusInfo": "http://www.microsoft.com", | ||
"FileDigest": "/fd \"SHA256\"", | ||
"PageHash": "/NPH", | ||
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" | ||
}, | ||
"ToolName": "sign", | ||
"ToolVersion": "1.0" | ||
}, | ||
{ | ||
"KeyCode": "CP-230012", | ||
"OperationCode": "SigntoolVerify", | ||
"Parameters": {}, | ||
"ToolName": "sign", | ||
"ToolVersion": "1.0" | ||
} | ||
] | ||
SessionTimeout: '60' | ||
MaxConcurrency: '50' | ||
MaxRetryAttempts: '5' | ||
|
||
# SBOM generator task for additional supply chain protection | ||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 | ||
displayName: 'Manifest Generator ' | ||
inputs: | ||
BuildDropPath: '$(System.DefaultWorkingDirectory)' | ||
|
||
# dotnet pack | ||
# Packaging needs to be a separate step from build. | ||
# This will automatically pick up the signed DLLs. | ||
- task: DotNetCoreCLI@2 | ||
displayName: 'dotnet pack WebJobs.Extensions.DurableTask.Analyzers.csproj' | ||
inputs: | ||
command: pack | ||
packagesToPack: 'src/**/WebJobs.Extensions.DurableTask.Analyzers.csproj' | ||
configuration: Release | ||
packDirectory: 'azure-functions-durable-extension' | ||
nobuild: true | ||
|
||
# Remove redundant symbol package(s) | ||
- script: | | ||
echo *** Searching for .symbols.nupkg files to delete... | ||
dir /s /b *.symbols.nupkg | ||
echo *** Deleting .symbols.nupkg files... | ||
del /S /Q *.symbols.nupkg | ||
echo *** Listing remaining packages | ||
dir /s /b *.nupkg | ||
displayName: 'Remove Redundant Symbols Package(s)' | ||
continueOnError: true | ||
|
||
# Digitally sign all the nuget packages with the Microsoft certificate. | ||
# This appears to be an in-place signing job, which is convenient. | ||
- task: EsrpCodeSigning@1 | ||
inputs: | ||
ConnectedServiceName: 'ESRP Service' | ||
FolderPath: '$(System.DefaultWorkingDirectory)' | ||
Pattern: '*.nupkg' | ||
signConfigType: 'inlineSignParams' | ||
inlineOperation: | | ||
[ | ||
{ | ||
"KeyCode": "CP-401405", | ||
"OperationCode": "NuGetSign", | ||
"Parameters": {}, | ||
"ToolName": "sign", | ||
"ToolVersion": "1.0" | ||
}, | ||
{ | ||
"KeyCode": "CP-401405", | ||
"OperationCode": "NuGetVerify", | ||
"Parameters": {}, | ||
"ToolName": "sign", | ||
"ToolVersion": "1.0" | ||
} | ||
] | ||
SessionTimeout: '60' | ||
MaxConcurrency: '50' | ||
MaxRetryAttempts: '5' | ||
|
||
# Make the nuget packages available for download in the ADO portal UI | ||
- publish: '$(System.DefaultWorkingDirectory)/azure-functions-durable-extension' | ||
displayName: 'Publish nuget packages to Artifacts' | ||
artifact: PackageOutput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
## Bug Fixes | ||
- Correctly Serialize HostStoppingEvent in ActivityShim (https://github.com/Azure/azure-functions-durable-extension/pull/2178) | ||
- Fix NotImplementedException for management API calls from Java client (https://github.com/Azure/azure-functions-durable-extension/pull/2193) | ||
- Handle OOM and other exceptions in entity shim by aborting the session (https://github.com/Azure/azure-functions-durable-extension/pull/2234) | ||
|
||
## Enhancements | ||
- add optional 'instanceIdPrefix' query parameter to the HTTP API for instance queries | ||
|
||
## Dependencies | ||
- DurableTask.Core --> v2.10.* | ||
- DurableTask.AzureStorage --> v1.12.* | ||
- DurableTask.AzureStorage --> v1.12.* | ||
- DurableTask.Analyzers --> 0.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...bs.Extensions.DurableTask.Analyzers/Analyzers/Orchestrator/DependencyInjectionAnalyzer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CSharp; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
|
||
namespace Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers | ||
{ | ||
[DiagnosticAnalyzer(LanguageNames.CSharp)] | ||
public class DependencyInjectionAnalyzer | ||
{ | ||
public const string DiagnosticId = "DF0113"; | ||
|
||
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(Resources.DependencyInjectionAnalyzerTitle), Resources.ResourceManager, typeof(Resources)); | ||
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(Resources.DeterministicAnalyzerMessageFormat), Resources.ResourceManager, typeof(Resources)); | ||
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(Resources.DeterministicAnalyzerDescription), Resources.ResourceManager, typeof(Resources)); | ||
private const string Category = SupportedCategories.Orchestrator; | ||
public const DiagnosticSeverity Severity = DiagnosticSeverity.Warning; | ||
|
||
public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, Severity, isEnabledByDefault: true, description: Description); | ||
|
||
public static bool RegisterDiagnostic(CompilationAnalysisContext context, SyntaxNode method) | ||
{ | ||
var diagnosedIssue = false; | ||
|
||
if (!SyntaxNodeUtils.IsInStaticClass(method)) | ||
{ | ||
if(TryGetInjectedVariables(method, out List<SyntaxNode> injectedVariables)) | ||
{ | ||
var methodVariablesUsed = method.DescendantNodes().Where(x => x.IsKind(SyntaxKind.IdentifierName)); | ||
|
||
var varaiblesToDiagnose = methodVariablesUsed.Where(x => injectedVariables.Exists(y => y.ToString() == x.ToString())); | ||
|
||
foreach (var variable in varaiblesToDiagnose) | ||
{ | ||
var diagnostic = Diagnostic.Create(Rule, variable.GetLocation(), variable); | ||
|
||
if (context.Compilation.ContainsSyntaxTree(method.SyntaxTree)) | ||
{ | ||
context.ReportDiagnostic(diagnostic); | ||
} | ||
|
||
diagnosedIssue = true; | ||
} | ||
} | ||
} | ||
|
||
return diagnosedIssue; | ||
} | ||
|
||
private static bool TryGetInjectedVariables(SyntaxNode method, out List<SyntaxNode> injectedVariables) | ||
{ | ||
injectedVariables = new List<SyntaxNode>(); | ||
var addedVariable = false; | ||
if (SyntaxNodeUtils.TryGetConstructor(method, out ConstructorDeclarationSyntax constructor)) | ||
{ | ||
var parameters = constructor.ParameterList.ChildNodes(); | ||
var injectedParameterNames = new List<SyntaxToken>(); | ||
foreach (SyntaxNode parameter in parameters) | ||
{ | ||
injectedParameterNames.Add(parameter.ChildTokens().FirstOrDefault(x => x.IsKind(SyntaxKind.IdentifierToken))); | ||
} | ||
|
||
var assignementExpressions = constructor.DescendantNodes().Where(x => x.IsKind(SyntaxKind.SimpleAssignmentExpression)); | ||
|
||
foreach (AssignmentExpressionSyntax assignmentExpression in assignementExpressions) | ||
{ | ||
var injectedRightSideNode = assignmentExpression.Right.DescendantNodes().Where(x => x.IsKind(SyntaxKind.IdentifierName) && injectedParameterNames.Contains(((IdentifierNameSyntax)x).Identifier)); | ||
|
||
if (injectedRightSideNode == null) | ||
{ | ||
continue; | ||
} | ||
|
||
var assignedLeftSideNode = assignmentExpression.Left.DescendantNodes().FirstOrDefault(x => x.IsKind(SyntaxKind.IdentifierName)); | ||
|
||
if (assignedLeftSideNode != null) | ||
{ | ||
injectedVariables.Add(assignedLeftSideNode); | ||
addedVariable = true; | ||
} | ||
} | ||
} | ||
|
||
return addedVariable; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.