Skip to content

Commit

Permalink
Merge branch 'master' into users/sahilbhatt/debug_monitor_tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
sahilbhattMS authored Jan 9, 2025
2 parents c6e1003 + 4a8d9dd commit ca7c534
Show file tree
Hide file tree
Showing 24 changed files with 372 additions and 50 deletions.
16 changes: 16 additions & 0 deletions .CodeQL.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
path_classifiers:
test:
# Note: use only forward slash / as a path separator.
# * Matches any sequence of characters except a forward slash.
# ** Matches any sequence of characters, including a forward slash.
# This wildcard must either be surrounded by forward slash symbols, or used as the first segment of a path.
# It matches zero or more whole directory segments. There is no need to use a wildcard at the end of a directory path because all sub-directories are automatically matched.
# That is, /anything/ matches the anything directory and all its subdirectories.
# Always enclose the expression in double quotes if it includes *.
- src/Test

# The default behavior is to tag all files created during the
# build as `generated`. Results are hidden for generated code. You can tag
# further files as being generated by adding them to the `generated` section.
generated:
- _reports
2 changes: 1 addition & 1 deletion .azure-pipelines/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
)
# 1ES images used on the ARM pool doesn't contain unzip tool, so we need to install it before starting the build
- ${{ if and(eq(parameters.arch, 'arm64'), ne(parameters.os, 'osx')) }}:
- ${{ if and(eq(parameters.arch, 'arm64'), ne(parameters.os, 'osx'), ne(parameters.os, 'win')) }}:
- script: sudo dnf -y update && sudo dnf -y install unzip
displayName: Install unzip
retryCountOnTaskFailure: 5
Expand Down
23 changes: 23 additions & 0 deletions .azure-pipelines/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ parameters:
- name: win_x86
type: boolean
default: true
- name: win_arm64
type: boolean
default: false
- name: linux_x64
type: boolean
default: true
Expand Down Expand Up @@ -182,6 +185,26 @@ extends:
publishArtifacts: ${{ parameters.publishArtifacts }}
buildAlternatePackage: ${{ parameters.buildAlternatePackage }}
targetFramework: ${{ parameters.targetFramework }}

# Windows (ARM64)
- ${{ if parameters.win_arm64 }}:
- template: /.azure-pipelines/build-jobs.yml@self
parameters:
jobName: build_windows_arm64
displayName: Windows (ARM64)
pool:
name: 1ES-ABTT-Shared-Pool
image: abtt-windows-2022
os: windows
os: win
arch: arm64
branch: ${{ parameters.branch }}
unitTests: false
functionalTests: false
sign: ${{ parameters.sign }}
publishArtifacts: ${{ parameters.publishArtifacts }}
buildAlternatePackage: ${{ parameters.buildAlternatePackage }}
targetFramework: ${{ parameters.targetFramework }}

# Linux (x64)
- ${{ if parameters.linux_x64 }}:
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dotnet_diagnostic.IDE0007.severity = none
dotnet_diagnostic.IDE0008.severity = none

# IDE0010: Add missing cases
dotnet_diagnostic.IDE0010.severity = warning
dotnet_diagnostic.IDE0010.severity = none

# IDE0011: Add braces
dotnet_diagnostic.IDE0011.severity = suggestion
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Global rule:
* @microsoft/akvelon-build-task-team @microsoft/azure-pipelines-platform
* @microsoft/azure-pipelines-tasks-and-agent @microsoft/azure-pipelines-platform
5 changes: 5 additions & 0 deletions .vsts.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ parameters:
type: boolean
displayName: Windows (x86)
default: true
- name: win_arm64
type: boolean
displayName: Windows (ARM64)
default: false
- name: linux_x64
type: boolean
displayName: Linux (x64)
Expand Down Expand Up @@ -59,6 +63,7 @@ extends:
testProxyAgent: ${{ parameters.testProxyAgent }}
win_x64: ${{ parameters.win_x64 }}
win_x86: ${{ parameters.win_x86 }}
win_arm64: ${{ parameters.win_arm64 }}
linux_x64: ${{ parameters.linux_x64 }}
linux_arm: ${{ parameters.linux_arm }}
linux_arm64: ${{ parameters.linux_arm64 }}
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ Written for .NET Core in C#.
|---|:-----:|
|![Win-x64](docs/res/win_med.png) **Windows x64**|[![Build & Test][win-x64-build-badge]][build]|
|![Win-x86](docs/res/win_med.png) **Windows x86**|[![Build & Test][win-x86-build-badge]][build]|
|![Win-arm64](docs/res/win_med.png) **Windows ARM64**|[![Build & Test][win-arm64-build-badge]][build]|
|![macOS](docs/res/apple_med.png) **macOS**|[![Build & Test][macOS-build-badge]][build]|
|![Linux-x64](docs/res/linux_med.png) **Linux x64**|[![Build & Test][linux-x64-build-badge]][build]|
|![Linux-arm](docs/res/linux_med.png) **Linux ARM**|[![Build & Test][linux-arm-build-badge]][build]|
|![RHEL6-x64](docs/res/redhat_med.png) **RHEL 6 x64**|[![Build & Test][rhel6-x64-build-badge]][build]|
|![Linux-x64](docs/res/linux_med.png) **Linux x64**|[![Build & Test][linux-x64-build-badge]][build]|
|![Linux-arm](docs/res/linux_med.png) **Linux ARM**|[![Build & Test][linux-arm-build-badge]][build]|
|![RHEL6-x64](docs/res/redhat_med.png) **RHEL 6 x64**|[![Build & Test][rhel6-x64-build-badge]][build]|

[win-x64-build-badge]: https://mseng.visualstudio.com/pipelinetools/_apis/build/status/VSTS.Agent/azure-pipelines-agent.ci?branchName=master&jobname=Windows%20(x64)
[win-x86-build-badge]: https://mseng.visualstudio.com/pipelinetools/_apis/build/status/VSTS.Agent/azure-pipelines-agent.ci?branchName=master&jobname=Windows%20(x86)
[win-arm64-build-badge]: https://mseng.visualstudio.com/pipelinetools/_apis/build/status/VSTS.Agent/azure-pipelines-agent.ci?branchName=master&jobname=Windows%20(ARM64)
[macOS-build-badge]: https://mseng.visualstudio.com/pipelinetools/_apis/build/status/VSTS.Agent/azure-pipelines-agent.ci?branchName=master&jobname=macOS%20(x64)
[linux-x64-build-badge]: https://mseng.visualstudio.com/pipelinetools/_apis/build/status/VSTS.Agent/azure-pipelines-agent.ci?branchName=master&jobname=Linux%20(x64)
[linux-arm-build-badge]: https://mseng.visualstudio.com/pipelinetools/_apis/build/status/VSTS.Agent/azure-pipelines-agent.ci?branchName=master&jobname=Linux%20(ARM)
Expand Down
12 changes: 12 additions & 0 deletions assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
"version": "<AGENT_VERSION>",
"downloadUrl": "https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/pipelines-agent-win-x86-<AGENT_VERSION>.zip"
},
{
"name": "vsts-agent-win-arm64-<AGENT_VERSION>.zip",
"platform": "win-arm64",
"version": "<AGENT_VERSION>",
"downloadUrl": "https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-win-arm64-<AGENT_VERSION>.zip"
},
{
"name": "pipelines-agent-win-arm64-<AGENT_VERSION>.zip",
"platform": "win-arm64",
"version": "<AGENT_VERSION>",
"downloadUrl": "https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/pipelines-agent-win-arm64-<AGENT_VERSION>.zip"
},
{
"name": "vsts-agent-osx-x64-<AGENT_VERSION>.tar.gz",
"platform": "osx-x64",
Expand Down
16 changes: 16 additions & 0 deletions src/Agent.Listener/net6.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@
}
]
},
{
"id": "ol",
"versions": [
{
"name": "7+"
}
]
},
{
"id": "rocky",
"versions": [
{
"name": "8+"
}
]
},
{
"id": "sles",
"versions": [
Expand Down
24 changes: 16 additions & 8 deletions src/Agent.Listener/net8.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@
}
]
},
{
"id": "ol",
"versions": [
{
"name": "8+"
}
]
},
{
"id": "macOS",
"versions": [
Expand Down Expand Up @@ -82,6 +74,22 @@
}
]
},
{
"id": "ol",
"versions": [
{
"name": "8+"
}
]
},
{
"id": "rocky",
"versions": [
{
"name": "8+"
}
]
},
{
"id": "sles",
"versions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class LegacyTestRunDataPublisher : AgentService, ILegacyTestRunDataPublis
private int _runCounter = 0;
private IFeatureFlagService _featureFlagService;
private bool _calculateTestRunSummary;
private bool _isFlakyCheckEnabled;
private string _testRunner;
private ITestResultsServer _testResultsServer;
private TestRunDataPublisherHelper _testRunPublisherHelper;
Expand All @@ -54,6 +55,7 @@ public void InitializePublisher(IExecutionContext context, string projectName, V
_testResultsServer = HostContext.GetService<ITestResultsServer>();
_testResultsServer.InitializeServer(connection, _executionContext);
_calculateTestRunSummary = _featureFlagService.GetFeatureFlagState(TestResultsConstants.CalculateTestRunSummaryFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid);
_isFlakyCheckEnabled = _featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableFlakyCheckInAgentFeatureFlag, TestResultsConstants.TCMServiceInstanceGuid);
_testRunPublisherHelper = new TestRunDataPublisherHelper(_executionContext, null, _testRunPublisher, _testResultsServer);
Trace.Leaving();
}
Expand Down Expand Up @@ -208,9 +210,7 @@ private async Task<bool> PublishAllTestResultsToSingleTestRunAsync(List<string>

// Check failed results for flaky aware
// Fallback to flaky aware if there are any failures.
bool isFlakyCheckEnabled = _featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableFlakyCheckInAgentFeatureFlag, TestResultsConstants.TCMServiceInstanceGuid);

if (isTestRunOutcomeFailed && isFlakyCheckEnabled)
if (isTestRunOutcomeFailed && _isFlakyCheckEnabled)
{
IList<TestRun> publishedRuns = new List<TestRun>();
publishedRuns.Add(updatedRun);
Expand Down Expand Up @@ -313,9 +313,7 @@ private async Task<bool> PublishToNewTestRunPerTestResultFileAsync(List<string>

// Check failed results for flaky aware
// Fallback to flaky aware if there are any failures.
bool isFlakyCheckEnabled = _featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableFlakyCheckInAgentFeatureFlag, TestResultsConstants.TCMServiceInstanceGuid);

if (isTestRunOutcomeFailed && isFlakyCheckEnabled)
if (isTestRunOutcomeFailed && _isFlakyCheckEnabled)
{
var runOutcome = _testRunPublisherHelper.CheckRunsForFlaky(publishedRuns, _projectName);
if (runOutcome != null && runOutcome.HasValue)
Expand Down
40 changes: 21 additions & 19 deletions src/Agent.Worker/TestResults/TestDataPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public sealed class TestDataPublisher : AgentService, ITestDataPublisher
private IFeatureFlagService _featureFlagService;
private string _testRunner;
private bool _calculateTestRunSummary;
private bool _isFlakyCheckEnabled;
private TestRunDataPublisherHelper _testRunPublisherHelper;
private ITestResultsServer _testResultsServer;

Expand All @@ -58,6 +59,8 @@ public void InitializePublisher(IExecutionContext context, string projectName, V
var extensionManager = HostContext.GetService<IExtensionManager>();
_featureFlagService = HostContext.GetService<IFeatureFlagService>();
_featureFlagService.InitializeFeatureService(_executionContext, connection);
_calculateTestRunSummary = _featureFlagService.GetFeatureFlagState(TestResultsConstants.CalculateTestRunSummaryFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid);
_isFlakyCheckEnabled = _featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableFlakyCheckInAgentFeatureFlag, TestResultsConstants.TCMServiceInstanceGuid); ;
_parser = (extensionManager.GetExtensions<IParser>()).FirstOrDefault(x => _testRunner.Equals(x.Name, StringComparison.OrdinalIgnoreCase));
_testRunPublisherHelper = new TestRunDataPublisherHelper(_executionContext, _testRunPublisher, null, _testResultsServer);
Trace.Leaving();
Expand Down Expand Up @@ -86,8 +89,6 @@ public void InitializePublisher(IExecutionContext context, string projectName, V

IList<TestRun> publishedRuns = publishtestRunDataTask.Result;

_calculateTestRunSummary = _featureFlagService.GetFeatureFlagState(TestResultsConstants.CalculateTestRunSummaryFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid);

var isTestRunOutcomeFailed = GetTestRunOutcome(_executionContext, testRunData, out TestRunSummary testRunSummary);

// Storing testrun summary in environment variable, which will be read by PublishPipelineMetadataTask and publish to evidence store.
Expand All @@ -98,9 +99,7 @@ public void InitializePublisher(IExecutionContext context, string projectName, V

// Check failed results for flaky aware
// Fallback to flaky aware if there are any failures.
bool isFlakyCheckEnabled = _featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableFlakyCheckInAgentFeatureFlag, TestResultsConstants.TCMServiceInstanceGuid);

if (isTestRunOutcomeFailed && isFlakyCheckEnabled)
if (isTestRunOutcomeFailed && _isFlakyCheckEnabled)
{
var runOutcome = _testRunPublisherHelper.CheckRunsForFlaky(publishedRuns, _projectName);
if (runOutcome != null && runOutcome.HasValue)
Expand Down Expand Up @@ -154,24 +153,31 @@ public void InitializePublisher(IExecutionContext context, string projectName, V

for (testRunDataIterator = 0; testRunDataIterator < testRunData.Count; testRunDataIterator++)
{
var testResultsUpdated = new List<TestCaseResultData>();
for (testResultDataIterator = 0; testResultDataIterator < testRunData[testRunDataIterator].TestResults.Count; testResultDataIterator++)
{
var testResultFQN = testRunData[testRunDataIterator].TestResults[testResultDataIterator].AutomatedTestStorage +
"." + testRunData[testRunDataIterator].TestResults[testResultDataIterator].AutomatedTestName;

if (testResultByFQN.TryGetValue(testResultFQN, out List<TestCaseResult> inputs))
{
testRunData[testRunDataIterator].TestResults[testResultDataIterator].TestPoint = inputs[0].TestPoint;
testRunData[testRunDataIterator].TestResults[testResultDataIterator].TestCaseTitle = inputs[0].TestCaseTitle;
testRunData[testRunDataIterator].TestResults[testResultDataIterator].Configuration = inputs[0].Configuration;
testRunData[testRunDataIterator].TestResults[testResultDataIterator].TestCase = inputs[0].TestCase;
testRunData[testRunDataIterator].TestResults[testResultDataIterator].Owner = inputs[0].Owner;
testRunData[testRunDataIterator].TestResults[testResultDataIterator].State = "5";
testRunData[testRunDataIterator].TestResults[testResultDataIterator].TestCaseRevision = inputs[0].TestCaseRevision;

testResultByFQN[testResultFQN].RemoveAt(0);
foreach (var input in inputs)
{
var testCaseResultDataUpdated = TestResultUtils.CloneTestCaseResultData(testRunData[testRunDataIterator].TestResults[testResultDataIterator]);

testCaseResultDataUpdated.TestPoint = input.TestPoint;
testCaseResultDataUpdated.TestCaseTitle = input.TestCaseTitle;
testCaseResultDataUpdated.Configuration = input.Configuration;
testCaseResultDataUpdated.TestCase = input.TestCase;
testCaseResultDataUpdated.Owner = input.Owner;
testCaseResultDataUpdated.State = "5";
testCaseResultDataUpdated.TestCaseRevision = input.TestCaseRevision;

testResultsUpdated.Add(testCaseResultDataUpdated);
}
}
}
testRunData[testRunDataIterator].TestResults = testResultsUpdated;
}
}

Expand All @@ -188,8 +194,6 @@ public void InitializePublisher(IExecutionContext context, string projectName, V

IList<TestRun> publishedRuns = publishtestRunDataTask.Result;

_calculateTestRunSummary = _featureFlagService.GetFeatureFlagState(TestResultsConstants.CalculateTestRunSummaryFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid);

var isTestRunOutcomeFailed = GetTestRunOutcome(_executionContext, testRunData, out TestRunSummary testRunSummary);

// Storing testrun summary in environment variable, which will be read by PublishPipelineMetadataTask and publish to evidence store.
Expand All @@ -200,9 +204,7 @@ public void InitializePublisher(IExecutionContext context, string projectName, V

// Check failed results for flaky aware
// Fallback to flaky aware if there are any failures.
bool isFlakyCheckEnabled = _featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableFlakyCheckInAgentFeatureFlag, TestResultsConstants.TCMServiceInstanceGuid);

if (isTestRunOutcomeFailed && isFlakyCheckEnabled)
if (isTestRunOutcomeFailed && _isFlakyCheckEnabled)
{
var runOutcome = _testRunPublisherHelper.CheckRunsForFlaky(publishedRuns, _projectName);
if (runOutcome != null && runOutcome.HasValue)
Expand Down
Loading

0 comments on commit ca7c534

Please sign in to comment.