From dbd9c49d3a991f6db64b998f5f1baadd7ec97111 Mon Sep 17 00:00:00 2001 From: Keyan Song Date: Thu, 19 Nov 2026 17:37:59 -0800 Subject: [PATCH 1/5] Add an example to the `az batch pool reset` help The CLI linter asks for at least one example on commands that a PR changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/azure-cli/azure/cli/command_modules/batch/_help.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/batch/_help.py b/src/azure-cli/azure/cli/command_modules/batch/_help.py index ff5545f306a..1fdab556e25 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/_help.py +++ b/src/azure-cli/azure/cli/command_modules/batch/_help.py @@ -554,6 +554,10 @@ helps['batch pool reset'] = """ type: command short-summary: Update the properties of a Batch pool. Unspecified properties which can be updated are reset to their defaults. +examples: + - name: Set a new start task on a pool and reset other properties to their defaults. + text: > + az batch pool reset --pool-id pool1 --start-task-command-line "/bin/sh -c 'echo ready'" """ helps['batch pool resize'] = """ From ca65d1212f593c9f6b50c56292975ed673e93e38 Mon Sep 17 00:00:00 2001 From: Keyan Song Date: Sun, 22 Nov 2026 20:18:32 -0800 Subject: [PATCH 2/5] Test the pre-announcement of the `az batch pool reset` output change test_batch_preannouncements expects the new entry with its exact warning, and test_batch_pool_reset_output checks that the command prints it. The output itself stays as it is on dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../tests/latest/test_batch_breaking_change.py | 14 +++++++++++--- .../batch/tests/latest/test_batch_output.py | 12 ++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_breaking_change.py b/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_breaking_change.py index fb843a0996d..649c90e61e7 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_breaking_change.py +++ b/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_breaking_change.py @@ -13,7 +13,7 @@ from azure.batch._operations._patch import BatchClientOperationsMixin from azure.cli.command_modules.batch._validators import validate_retained_data_option -from azure.cli.core.breaking_change import ExactVersion, upcoming_breaking_changes +from azure.cli.core.breaking_change import AzCLIOutputChange, ExactVersion, upcoming_breaking_changes from azure.cli.core.mock import DummyCli from azure.cli.core.util import rmtree_with_retry @@ -27,14 +27,22 @@ def test_batch_preannouncements(self): self.assertEqual(sorted(upcoming_breaking_changes), [ 'batch node delete.retaineddata', 'batch node reboot.retaineddata', + 'batch pool reset', 'batch pool resize.retaineddata', 'batch pool usage-metrics list']) - for changes in upcoming_breaking_changes.values(): + for name, changes in upcoming_breaking_changes.items(): self.assertEqual(len(changes), 1) # A fixed version number: the default report skips date targets, and the next window can move self.assertIsInstance(changes[0].target_version, ExactVersion) self.assertEqual(changes[0].target_version.version(), '2.100.0') - self.assertIn('will be removed in 2.100.0 (June 2027)', changes[0].message) + if name != 'batch pool reset': + self.assertIn('will be removed in 2.100.0 (June 2027)', changes[0].message) + output_change = upcoming_breaking_changes['batch pool reset'][0] + self.assertIsInstance(output_change, AzCLIOutputChange) + self.assertEqual(output_change.message, + "The output will be changed in 2.100.0. 'az batch pool reset' will print the pool in the " + "same format as 'az batch pool show'. Update scripts that read this output before " + "2.100.0 (June 2027); 'az batch pool show' already prints that format.") class TestBatchRetainedDataWarning(unittest.TestCase): diff --git a/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py b/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py index aa475363cde..6afd6efe631 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py +++ b/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py @@ -91,10 +91,14 @@ def test_batch_pool_show_output(self): {'nodeAgentSkuId': 'batch.node.ubuntu 20.04', 'osDisk': {'diskSizeGb': 100}}) def test_batch_pool_reset_output(self): - pool = self._invoke('batch pool reset --pool-id pool1 --start-task-command-line hostname', { - ('POST', '/pools/pool1/updateproperties'): (204, None), - ('GET', '/pools/pool1'): (200, POOL)}) - + with mock.patch('sys.stderr', new_callable=io.StringIO) as stderr: + pool = self._invoke('batch pool reset --pool-id pool1 --start-task-command-line hostname', { + ('POST', '/pools/pool1/updateproperties'): (204, None), + ('GET', '/pools/pool1'): (200, POOL)}) + + # The change to the format of 'pool show' is pre-announced for 2.100.0 + self.assertIn("The output will be changed in 2.100.0. 'az batch pool reset' will print the pool in the same " + "format as 'az batch pool show'.", stderr.getvalue()) # 'pool reset' prints the SDK model without the module's key changes, unlike 'pool show' self.assertEqual(pool['stats']['resourceStats']['diskReadIOps'], 3000000000) self.assertEqual(pool['stats']['resourceStats']['diskWriteIOps'], 2222) From 93b24e48f510450f1fb8cdb05176a5ebb3fe616c Mon Sep 17 00:00:00 2001 From: Keyan Song Date: Sun, 22 Nov 2026 20:20:39 -0800 Subject: [PATCH 3/5] {Batch} Pre-announce that `az batch pool reset` will print the pool in the same format as `az batch pool show` Since 2.69.0, `az batch pool reset` prints the pool in a different format from `az batch pool show`. Customers may rely on that format, so changing it is a breaking change: this pre-announces it for 2.100.0 (June 2027) with register_output_breaking_change. The output doesn't change now. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../cli/command_modules/batch/_breaking_change.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/batch/_breaking_change.py b/src/azure-cli/azure/cli/command_modules/batch/_breaking_change.py index 57b5f19ba98..1870306d078 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/_breaking_change.py +++ b/src/azure-cli/azure/cli/command_modules/batch/_breaking_change.py @@ -4,7 +4,7 @@ # -------------------------------------------------------------------------------------------- from azure.cli.core.breaking_change import (AzCLIOtherChange, register_command_deprecate, - register_conditional_breaking_change) + register_conditional_breaking_change, register_output_breaking_change) # The target version of every pre-announcement in this file: the CLI's breaking change release in June 2027. # The messages are custom, so they include it too, as TARGET_TEXT. @@ -19,6 +19,14 @@ "error. For more information, see https://github.com/Azure/Batch/issues/140." ) +register_output_breaking_change( + 'batch pool reset', + description="'az batch pool reset' will print the pool in the same format as 'az batch pool show'", + target_version=TARGET_VERSION, + guide=f"Update scripts that read this output before {TARGET_TEXT}; 'az batch pool show' already prints that " + "format" +) + # Printed by validate_retained_data_option only when the value 'retaineddata' is used RETAINED_DATA_TAG = 'retaineddata' From bff458d8b38fdd4590de877c2c0154f876df25cf Mon Sep 17 00:00:00 2001 From: Keyan Song Date: Sun, 22 Nov 2026 20:38:26 -0800 Subject: [PATCH 4/5] Show warnings in the Batch output tests even when AZURE_CORE_ONLY_SHOW_ERRORS is set test_batch_pool_reset_output checks the pre-announcement warning on stderr, which the CLI leaves out when only errors are shown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../command_modules/batch/tests/latest/test_batch_output.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py b/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py index 6afd6efe631..9685bb1d004 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py +++ b/src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_output.py @@ -46,8 +46,9 @@ class TestBatchOutput(unittest.TestCase): code turn a service response into the printed JSON, as they do for customers.""" def setUp(self): - # No Batch settings from AZURE_BATCH_* environment variables or the CLI config - environ = {name: value for name, value in os.environ.items() if not name.startswith('AZURE_BATCH_')} + # No Batch settings from AZURE_BATCH_* environment variables or the CLI config, and warnings are shown + environ = {name: value for name, value in os.environ.items() + if not name.startswith('AZURE_BATCH_') and name != 'AZURE_CORE_ONLY_SHOW_ERRORS'} environ_patch = mock.patch.dict(os.environ, environ, clear=True) environ_patch.start() self.addCleanup(environ_patch.stop) From 6a5be8ae8341ed51fe80d8bf18a792e8442479bb Mon Sep 17 00:00:00 2001 From: Keyan Song Date: Sun, 22 Nov 2026 20:38:27 -0800 Subject: [PATCH 5/5] Say that the `az batch pool reset` help example is for a Linux pool Its start task runs /bin/sh, which a Windows pool doesn't have. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/azure-cli/azure/cli/command_modules/batch/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/batch/_help.py b/src/azure-cli/azure/cli/command_modules/batch/_help.py index 1fdab556e25..5b94a5d4b8a 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/_help.py +++ b/src/azure-cli/azure/cli/command_modules/batch/_help.py @@ -555,7 +555,7 @@ type: command short-summary: Update the properties of a Batch pool. Unspecified properties which can be updated are reset to their defaults. examples: - - name: Set a new start task on a pool and reset other properties to their defaults. + - name: Set a new start task on a Linux pool and reset other properties to their defaults. text: > az batch pool reset --pool-id pool1 --start-task-command-line "/bin/sh -c 'echo ready'" """