Skip to content

Conversation

@dassayantan24
Copy link
Contributor

@dassayantan24 dassayantan24 commented Jan 13, 2026

Context

This change implements L1 tests for containers using Docker images, both with and without labels.

Work-Item [AB#2346693]- https://dev.azure.com/mseng/AzureDevOps/_workitems/edit/2346693


Description

Integration tests validating that the Azure Pipelines Agent reads the com.azure.dev.pipelines.agent.handler.node.path container label to resolve custom Node.js paths. Includes four platform-specific tests (Windows and Linux) that verify both label-based resolution and fallback behavior when the label is absent.


Risk Assessment (Low / Medium / High)

Low


Unit Tests Added or Updated (Yes / No)

Yes


Additional Testing Performed

NA


Change Behind Feature Flag (Yes / No)

No


Tech Design / Approach

  • Design has been written and reviewed. Yes
  • Any architectural decisions, trade-offs, and alternatives are captured.

Documentation Changes Required (Yes/No)

Indicate whether related documentation needs to be updated.

  • User guides, API specs, system diagrams, or runbooks are updated.

Logging Added/Updated (Yes/No)

  • Appropriate log statements are added with meaningful messages.
  • Logging does not expose sensitive data.
  • Log levels are used correctly (e.g., info, warn, error).

Telemetry Added/Updated (Yes/No)

  • Custom telemetry (e.g., counters, timers, error tracking) is added as needed.
  • Events are tagged with proper metadata for filtering and analysis.
  • Telemetry is validated in staging or test environments.

Rollback Scenario and Process (Yes/No)

  • Rollback plan is documented.

Dependency Impact Assessed and Regression Tested (Yes/No)

  • All impacted internal modules, APIs, services, and third-party libraries are analyzed.
  • Results are reviewed and confirmed to not break existing functionality.

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24 dassayantan24 changed the title Update L1 test Update L1 for Container Label Jan 14, 2026
@dassayantan24 dassayantan24 marked this pull request as ready for review January 14, 2026 06:22
@dassayantan24 dassayantan24 requested review from a team as code owners January 14, 2026 06:22
SetupL1();
var message = LoadTemplateMessage();

var containerResource = new Microsoft.TeamFoundation.DistributedTask.Pipelines.ContainerResource()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating object of type Microsoft.TeamFoundation.DistributedTask.Pipelines.ContainerResource, you can import it and create object of just ContainerResource. This would keep code clean.
Same for Code in line 82 for AgentJobRequestMessage

private async Task CreateTestContainerImageWindows()
{
string dockerfile = $@"FROM mcr.microsoft.com/windows/servercore/insider:10.0.20348.1
LABEL ""{ContainerLabelKey}""=""{CustomNodePathWindows}""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation here, same for below code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


var steps = GetSteps();
Assert.NotNull(steps);
Assert.True(steps.Count() >= 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests don't actually verify that the container label is being read and used. The assertions only check that steps exist or not. Can we validate that the custom node via label is actually used vs the agent's build in node.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are more like verifying that the agent doesn't crash when running containerized jobs with labels and without labels, as we don't have any container L1 tests for the agent. The label checking logic is mostly covered in the L0 PR that I have raised. Though I'll try to check if it's possible to validate custom node via label.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if label checking logic is part of L0 tests, how this validates worker crashed or not?
what are the scenario in which worker will crash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the ValidateNodePathUsage method to validate that the custom node path from the Docker label appears in the container execution logs.

private const string TestImageNameLinux = "azure-pipelines-agent-test-container-label-linux";
private const string TestImageNameWindowsNoLabel = "azure-pipelines-agent-test-container-nolabel-windows";
private const string TestImageNameLinuxNoLabel = "azure-pipelines-agent-test-container-nolabel-linux";
private const string CustomNodePathWindows = "C:\\Program Files\\nodejs\\node.exe";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we validate this path in ci/cd pipelines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI/CD validates the path by running a real container job and asserting that pathe appears in the execution logs. in method ValidateNodePathUsage


var steps = GetSteps();
Assert.NotNull(steps);
Assert.True(steps.Count() >= 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if label checking logic is part of L0 tests, how this validates worker crashed or not?
what are the scenario in which worker will crash

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24
Copy link
Contributor Author

/azo run

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dassayantan24
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants