Skip to content

[PostgreSQL] Add immutable backup support to flexible-server create - #34320

Merged
Naga Nandyala (naga-nandyala) merged 2 commits into
Azure:devfrom
rmendiza:rmendiza/immutableBackups
Nov 5, 2026
Merged

Naga Nandyala (naga-nandyala) merged 2 commits into
Azure:devfrom
rmendiza:rmendiza/immutableBackups

Conversation

@rmendiza

@rmendiza rmendiza commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests Suppressions
⚠️ None ️✔️ 130/130 ️✔️ None
⚠️AzureCLI-BreakingChangeTest
⚠️batch
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd batch pool create cmd batch pool create added parameter resource_tags
⚠️postgresql
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd postgres flexible-server create cmd postgres flexible-server create added parameter immutable_backup

Related command
az postgres flexible-server create

Description

Adding a new parameter for the postgresql flexible-server create command to include "Immutable backups"

Testing Guide
Manual

History Notes
[PostgreSQL] Add immutable backup support to flexible-server create


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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d30cea2e-7cc9-4e1f-ae2b-119cbc3c08a4
Copilot AI balanced review requested due to automatic review settings November 2, 2026 19:43
@azure-pipelines

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

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

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

The new payload and argument-validation tests are outside azdev’s normal latest-profile discovery path, so CI will not run them unless the module is moved to tests/latest/test_custom_commands.py.

1 open issue
What changed in this PR

Adds immutable backup support to az postgres flexible-server create, including argument validation, request payload handling, and usage documentation.

Changes:

  • Adds optional --immutable-backup Enabled|Disabled and passes it to the backup configuration.
  • Rejects enabled immutable backups when --node-count is supplied.
  • Adds a help example, unit tests, and a live-only scenario test.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​postgresql/​utils/​validators.py Validates incompatibility with elastic clusters.
src/​azure-cli/​azure/​cli/​command_modules/​postgresql/​tests/​unit/​test_custom_commands.py Tests argument parsing, validation, and payload serialization.
src/​azure-cli/​azure/​cli/​command_modules/​postgresql/​tests/​latest/​test_postgres_flexible_commands_backup.py Adds live-only coverage for enabled and disabled immutable backups.
src/​azure-cli/​azure/​cli/​command_modules/​postgresql/​commands/​custom_commands.py Passes the immutable backup setting into the SDK model.
src/​azure-cli/​azure/​cli/​command_modules/​postgresql/​_params.py Registers the new option and validator.
src/​azure-cli/​azure/​cli/​command_modules/​postgresql/​_help.py Adds an immutable backup creation example.

Review effort: Balanced

from azure.cli.command_modules.postgresql.commands import custom_commands


class FlexibleServerCreateTest(unittest.TestCase):
@nasc17

nasc17 commented Nov 2, 2026

Copy link
Copy Markdown
Member

William (@william051200) JaysonTaiMicrosoft there is a build error that does not seem specific to our changes. Could you please advise how to move forward

@yonzhan
Yong Zhang (yonzhan) requested a review from a team November 2, 2026 22:19
@yonzhan

Copy link
Copy Markdown
Collaborator

/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 with

@naga-nandyala Naga Nandyala (naga-nandyala) added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Nov 3, 2026
@x-engineering-agent

x-engineering-agent Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

X Engineering Agent Pull request review: Comments

rmendiza Two coverage gaps remain; CI and the immutable-backup scenario are not verified.

Paths below are relative to src/azure-cli/azure/cli/command_modules/postgresql/.

Check Status Detail
Agent live tests Not run This is a review-only PR.
Regression coverage Unverified For postgresql: 2 focused test file(s) changed.
Findings 3 medium findings 3 medium
Risk Risk 17/100 Low Low; owner review recommended

To address

Tick each item as you address it.

  • Medium Collect the new unit tests

    Details and fix

    tests/unit/test_custom_commands.py:17: normal azdev test --profile latest excludes this directory. The pipeline uses that profile; its pinned azdev discovers command-module files only under tests/<profile>. Thus the payload and invalid-argument checks do not protect CI. Move the file to tests/latest/test_custom_commands.py; rediscover and run both FlexibleServerCreateTest and FlexibleServerCreateArgumentsTest in the latest suite.

  • Medium Record the immutable-backup scenario

    Details and fix

    tests/latest/test_postgres_flexible_commands_backup.py:22: @live_only() skips playback, and tests/latest/recordings/test_postgres_flexible_server_immutable_backup_mgmt.yaml is missing. The new wire field has no recorded regression. Remove the live-only restriction, record that scenario, then rerun test_postgres_flexible_server_immutable_backup_mgmt in playback. Preserve both Enabled/Disabled backup.immutableBackup and retention assertions (lines 36–37), checking the recorded create payload too.

  • Medium Upstream CI

    Details and fix

    azdev-style

    • Result: failure
    • Relevance: Uncertain
    • Evidence: The check completed without a concise diagnostic.
    • Suggested fix: Open the linked log and confirm whether the first actionable error touches the PR diff before changing code.
    • Verify: Re-run azdev-style and confirm it passes on the new head.

    Azure.azure-cli

    • Result: failure
    • Failure details:
      • Unit Test for Core Python312 (Not PR-related)
        • Evidence: The job running on agent pool-ubuntu-2204 137 ran longer than the maximum time of 10 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
        • Next action: Re-run the timed-out job. If it times out again at the same setup or checkout step, escalate to the pipeline owner instead of changing unrelated PR source.
        • Verify: Re-run Unit Test for Core Python312 and confirm the job completes within its limit.
      • Unit Test for Core Python314 (Not PR-related)
        • Evidence: The job running on agent pool-ubuntu-2204 139 ran longer than the maximum time of 10 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
        • Next action: Re-run the timed-out job. If it times out again at the same setup or checkout step, escalate to the pipeline owner instead of changing unrelated PR source.
        • Verify: Re-run Unit Test for Core Python314 and confirm the job completes within its limit.
      • Unit Test for Telemetry Python312 (Not PR-related)
        • Evidence: The job running on agent pool-ubuntu-2204 138 ran longer than the maximum time of 10 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
        • Next action: Re-run the timed-out job. If it times out again at the same setup or checkout step, escalate to the pipeline owner instead of changing unrelated PR source.
        • Verify: Re-run Unit Test for Telemetry Python312 and confirm the job completes within its limit.
      • Unit Test for Telemetry Python314 (Not PR-related)
        • Evidence: The job running on agent pool-ubuntu-2204 140 ran longer than the maximum time of 10 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
        • Next action: Re-run the timed-out job. If it times out again at the same setup or checkout step, escalate to the pipeline owner instead of changing unrelated PR source.
        • Verify: Re-run Unit Test for Telemetry Python314 and confirm the job completes within its limit.
Review details

Test validation

  • Agent live test: Not run; this is a review-only PR. Check author-provided test evidence and upstream CI separately.
  • Regression coverage: For postgresql: 2 focused test file(s) changed. Scenario coverage is unverified; review the issue's required conditions, test setup, and assertions before approval. Changed tests invoke az postgres flexible-server create, but invocation alone does not verify the required scenario or output. No linked issue was found in the PR timeline; inspect the source issue and its required scenario manually.

Risk assessment

17/100 · Low

The Low rating is driven by public CLI behavior.

  • Change scope: 6 changed files, 159 changed lines (+154 / -5), including 4 production files.
  • Affected components: postgresql
  • Risk drivers: public CLI behavior (+18)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is recommended for postgresql before merge.

Ask the Agent

Tick a box to queue an action. Requires write access to this repository.

  • Re-review this PR
  • Run Agent live tests on this PR

X Engineering Agent · Reviewer · React with +1 or -1 to train the agent

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Nov 3, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d30cea2e-7cc9-4e1f-ae2b-119cbc3c08a4
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@rmendiza
rmendiza requested a review from nasc17 November 3, 2026 16:24
@rmendiza

rmendiza commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 34320 in repo Azure/azure-cli

@rmendiza

rmendiza commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Aditya Pujara (@a0x1ab) can you please re-run the CLI style check? It's failing pre-check.

@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@rmendiza

rmendiza commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Aditya Pujara (@a0x1ab) Yong Zhang (@yonzhan) the pipelines appear to be having issues and not completing or getting stuck. Can you please help look into this?

@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

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@naga-nandyala
Naga Nandyala (naga-nandyala) merged commit 53fef3e into Azure:dev Nov 5, 2026
52 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad Backup Request X Engineering Agent Ask the agent to triage this issue or review this PR X Engineering Agent Reviewed Agent reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants