Skip to content

{Cognitive Services} Resolve Docker executable paths for hosted agent builds - #34304

Merged
mansoor sarfraz (msarfraz) merged 2 commits into
Azure:devfrom
M-Hietala:m-hietala/resolve_docker_executable_paths
Nov 9, 2026
Merged

mansoor sarfraz (msarfraz) merged 2 commits into
Azure:devfrom
M-Hietala:m-hietala/resolve_docker_executable_paths

Conversation

@M-Hietala

@M-Hietala M-Hietala commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests Suppressions
️✔️ None ️✔️ 130/130 ️✔️ None

Related command
az cognitiveservices agent create --source

Description
Align Docker command discovery with the established ACR module pattern.

This change resolves Docker to an absolute executable path before availability checks and local build/push operations. It ensures that the same resolved executable is used consistently throughout the source-build workflow.

Adds focused unit coverage for executable resolution and Docker subprocess invocation.

Testing Guide
Run the hosted-agent helper unit tests:

python -m pytest src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent.py::CognitiveServicesAgentHelperTests -q

History Notes
None. Internal implementation change only.


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 18:22
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Returning the Docker symlink target breaks executable-name dispatch for Snap installations, causing daemon checks to misidentify working Docker installations as unavailable and build/push operations to invoke the wrong command.

1 open issue
What changed in this PR

This PR updates Docker discovery for Cognitive Services hosted-agent source builds, using absolute executable paths for local Docker operations.

Changes:

  • Adds executable resolution with checks rejecting Docker entries or symlink targets in the current directory.
  • Uses resolved paths for Docker availability checks, builds, and pushes.
  • Replaces environment-dependent testing with mocked subprocess and resolution tests.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​tests/​latest/​test_agent.py Adds focused tests for executable resolution and Docker subprocess calls.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​custom.py Adds Docker path resolution and applies it to availability, build, and push operations.

Review effort: Balanced

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@yonzhan

Copy link
Copy Markdown
Collaborator

Adding mansoor sarfraz (@msarfraz) to help review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@msarfraz
mansoor sarfraz (msarfraz) merged commit 8c642b6 into Azure:dev Nov 9, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants