Repository navigation
[PostgreSQL] az postgres flexible-server deploy: Resolve deployment tool paths consistently - #34308
Merged
Naga Nandyala (naga-nandyala) merged 3 commits intoNov 9, 2026
Conversation
Reuse executable lookup and retain resolved Git and GitHub CLI paths throughout deployment operations. Preserve arguments containing spaces and cover the deployment flows with unit tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Thank you for your contribution Gabriel Lobo (@thegabrielobo)! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test fixture accepts nonexistent tools and breaks missing-tool tests on Linux, while PATHEXT-dependent lookup can reject valid Git/GitHub CLI executables.
2 open issues
What changed in this PR
This PR makes PostgreSQL deployment commands resolve and reuse Git and GitHub CLI executable paths, while preserving paths and arguments containing spaces. MySQL commands and the core subprocess helper remain unchanged.
Changes:
- Add deployment-tool resolution with Windows native-executable and absolute-path checks.
- Pass resolved paths and argument lists through authentication, secret management, repository operations, and workflow execution.
- Add focused tests for executable lookup and subprocess invocation.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/postgresql/utils/_flexible_server_util.py |
Adds executable resolution and updates deployment helpers to use resolved paths and argument lists. |
src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_deploy_commands.py |
Adds mocked coverage for lookup, path reuse, and deployment subprocess calls. |
src/azure-cli/azure/cli/command_modules/postgresql/commands/deploy_commands.py |
Retains resolved tool paths throughout deployment setup and workflow execution. |
Review effort: Balanced
| patch('subprocess.run', self.run), | ||
| patch('subprocess.Popen', self.popen), | ||
| patch('builtins.open', mock_open()), | ||
| patch.object(_util.os.path, 'exists', return_value=True), |
Comment on lines
+266
to
+267
| name = executable if os.path.splitext(executable)[1] else executable + '.exe' | ||
| resolved = executable if explicit else get_safe_executable_path(name) |
Member
There was a problem hiding this comment.
Gabriel Lobo (@thegabrielobo) could you look into the suggestion
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Naga Nandyala (naga-nandyala)
approved these changes
Nov 9, 2026
This was referenced Nov 9, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


🤖 PR Validation —⚠️ Review suggested
This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.
5 added suppressions
src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_deploy_commands.py@unittest.skipUnless(is_windows(), 'Windows executable lookup')src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_deploy_commands.py@unittest.skipUnless(is_windows(), 'Windows executable lookup')src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_deploy_commands.py@unittest.skipUnless(is_windows(), 'Windows executable lookup')src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_deploy_commands.py@unittest.skipUnless(is_windows(), 'Windows executable lookup')src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_deploy_commands.py@unittest.skipUnless(is_windows(), 'Windows executable lookup')Related command
az postgres flexible-server deploy setupaz postgres flexible-server deploy runDescription
Resolve Git and GitHub CLI paths before use and retain the resolved paths throughout PostgreSQL deployment setup and workflow execution.
This change is limited to PostgreSQL deployment commands. It does not change MySQL commands or the core subprocess helper.
Testing Guide
Validated on Windows with Python 3.14, using repository sources and an isolated dependency environment.
Set source imports from the repository root before running the commands:
Passed: 21 tests and 18 subtests; 30 unrelated tests deselected.
All three checks passed. Deployment subprocesses and Azure calls are mocked; no live deployment was performed. The full suite, Linux execution, and azdev style/linter checks were not run locally.
History Notes
[PostgreSQL]
az postgres flexible-server deploy: Resolve deployment tool paths consistentlyThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.