Skip to content

[ACR] Fix #31130: Fix extra version line in encodedTask created by file#31153

Merged
zhoxing-ms merged 2 commits intoAzure:devfrom
wju-MSFT:wju/31130
Apr 7, 2025
Merged

[ACR] Fix #31130: Fix extra version line in encodedTask created by file#31153
zhoxing-ms merged 2 commits intoAzure:devfrom
wju-MSFT:wju/31130

Conversation

@wju-MSFT
Copy link
Contributor

@wju-MSFT wju-MSFT commented Mar 28, 2025

Related command
az acr task show
Description
This pr removes the added version line to a file created encoded tasks.
fix #31130
Testing Guide
Create a file created encoded task and run
az acr task show -n <TaskName>-r <ResourceGroup> --query step.encodedTaskContent -o tsv | base64 --decode
no extra version line added.
History Notes


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

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 28, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 28, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 28, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@wju-MSFT wju-MSFT marked this pull request as ready for review March 28, 2025 14:02
@wju-MSFT wju-MSFT changed the title [ACR]fix extra version line in encodedTask created by file [ACR] fix extra version line in encodedTask created by file Mar 28, 2025
Copy link
Member

@northtyphoon northtyphoon left a comment

Choose a reason for hiding this comment

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

LGTM

@zhoxing-ms zhoxing-ms changed the title [ACR] fix extra version line in encodedTask created by file [ACR] Fix #31130: Fix extra version line in encodedTask created by file Apr 7, 2025
@zhoxing-ms zhoxing-ms merged commit be65c87 into Azure:dev Apr 7, 2025
53 checks passed
@bebound
Copy link
Contributor

bebound commented Apr 8, 2025

This PR breaks CI:

2025-04-07T15:27:04.8991426Z ______________________ AcrTaskCommandsTests.test_acr_task ______________________
2025-04-07T15:27:04.8991638Z [gw2] linux -- Python 3.9.19 /usr/bin/python
2025-04-07T15:27:04.8991808Z self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fcf2bd12a00>
2025-04-07T15:27:04.8992100Z cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fcf307c9970>
2025-04-07T15:27:04.8992366Z command = 'acr task create -n contextlessTaskfile -r clireg000002 -f /usr/lib/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/tests/latest/taskfilesample.yaml -c /dev/null'
2025-04-07T15:27:04.8992581Z expect_failure = False
2025-04-07T15:27:04.8992644Z 
2025-04-07T15:27:04.8992843Z     def _in_process_execute(self, cli_ctx, command, expect_failure=False):
2025-04-07T15:27:04.8993077Z         from io import StringIO
2025-04-07T15:27:04.8993238Z         from vcr.errors import CannotOverwriteExistingCassetteException
2025-04-07T15:27:04.8993390Z     
2025-04-07T15:27:04.8993515Z         if command.startswith('az '):
2025-04-07T15:27:04.8993652Z             command = command[3:]
2025-04-07T15:27:04.8993775Z     
2025-04-07T15:27:04.8993891Z         stdout_buf = StringIO()
2025-04-07T15:27:04.8994027Z         logging_buf = StringIO()
2025-04-07T15:27:04.8994149Z         try:
2025-04-07T15:27:04.8994851Z             # issue: stderr cannot be redirect in this form, as a result some failure information
2025-04-07T15:27:04.8995157Z             # is lost when command fails.
2025-04-07T15:27:04.8995460Z >           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
2025-04-07T15:27:04.8995631Z 
2025-04-07T15:27:04.8995909Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/testsdk/base.py:302: 
2025-04-07T15:27:04.8996267Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-07T15:27:04.8996522Z /usr/lib64/az/lib/python3.9/site-packages/knack/cli.py:245: in invoke
2025-04-07T15:27:04.8996847Z     exit_code = self.exception_handler(ex)
2025-04-07T15:27:04.8997183Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/__init__.py:129: in exception_handler
2025-04-07T15:27:04.8997543Z     return handle_exception(ex)
2025-04-07T15:27:04.8997794Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-07T15:27:04.8997917Z 
2025-04-07T15:27:04.8998178Z ex = CLIError('/usr/lib/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/tests/latest/taskfilesample.yaml does not exist.')
2025-04-07T15:27:04.8998459Z args = (), kwargs = {}
2025-04-07T15:27:04.8998516Z 
2025-04-07T15:27:04.8998686Z     def _handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
2025-04-07T15:27:04.8998874Z         if isinstance(ex, CannotOverwriteExistingCassetteException):
2025-04-07T15:27:04.8999060Z             # This exception usually caused by a no match HTTP request. This is a product error
2025-04-07T15:27:04.8999239Z             # that is caused by change of SDK invocation.
2025-04-07T15:27:04.8999374Z             raise ex
2025-04-07T15:27:04.8999651Z     
2025-04-07T15:27:04.8999857Z >       raise CliExecutionError(ex)
2025-04-07T15:27:04.9000151Z E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception CLIError during execution and fails the command.
2025-04-07T15:27:04.9000260Z 
2025-04-07T15:27:04.9000424Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/testsdk/patches.py:35: CliExecutionError
2025-04-07T15:27:04.9000514Z 
2025-04-07T15:27:04.9000660Z During handling of the above exception, another exception occurred:
2025-04-07T15:27:04.9000737Z 
2025-04-07T15:27:04.9000908Z self = <command_modules.acr.tests.latest.test_acr_task_commands.AcrTaskCommandsTests testMethod=test_acr_task>
2025-04-07T15:27:04.9001091Z resource_group = 'clitest.rg000001'
2025-04-07T15:27:04.9001155Z 
2025-04-07T15:27:04.9001272Z     @ResourceGroupPreparer()
2025-04-07T15:27:04.9001414Z     def test_acr_task(self, resource_group):
2025-04-07T15:27:04.9001582Z         curr_dir = os.path.dirname(os.path.realpath(__file__))
2025-04-07T15:27:04.9001732Z         self.kwargs.update({
2025-04-07T15:27:04.9001883Z             'registry_name': self.create_random_name('clireg', 20),
2025-04-07T15:27:04.9002031Z             'task_name': 'testTask',
2025-04-07T15:27:04.9002181Z             'task_no_context_cmd': 'contextlessTaskCmd',
2025-04-07T15:27:04.9002341Z             'task_no_context_file': 'contextlessTaskfile',
2025-04-07T15:27:04.9002483Z             'rg_loc': 'westus',
2025-04-07T15:27:04.9002616Z             'sku': 'Standard',
2025-04-07T15:27:04.9002746Z             'no_context': '/dev/null',
2025-04-07T15:27:04.9002911Z             'context': 'https://github.com/Azure-Samples/acr-build-helloworld-node',
2025-04-07T15:27:04.9003068Z             'file': 'Dockerfile',
2025-04-07T15:27:04.9003207Z             'image': 'testtask:v1',
2025-04-07T15:27:04.9003342Z             'existing_image': 'bash',
2025-04-07T15:27:04.9003477Z             'trigger_enabled': 'False',
2025-04-07T15:27:04.9003614Z             'identity': '[system]',
2025-04-07T15:27:04.9003751Z             'loginServer': 'test.acr.com',
2025-04-07T15:27:04.9003922Z             'file_path': os.path.join(curr_dir, 'taskfilesample.yaml').replace('\\', '\\\\')
2025-04-07T15:27:04.9004068Z         })
2025-04-07T15:27:04.9004312Z         self.cmd('acr create -n {registry_name} -g {rg} -l {rg_loc} --sku {sku}',
2025-04-07T15:27:04.9004483Z                  checks=[self.check('name', '{registry_name}'),
2025-04-07T15:27:04.9004644Z                          self.check('location', '{rg_loc}'),
2025-04-07T15:27:04.9004982Z                          self.check('adminUserEnabled', False),
2025-04-07T15:27:04.9005132Z                          self.check('sku.name', 'Standard'),
2025-04-07T15:27:04.9005284Z                          self.check('sku.tier', 'Standard'),
2025-04-07T15:27:04.9005439Z                          self.check('provisioningState', 'Succeeded')])
2025-04-07T15:27:04.9005575Z     
2025-04-07T15:27:04.9005695Z         # Create a docker build task.
2025-04-07T15:27:04.9005937Z         self.cmd('acr task create -n {task_name} -r {registry_name} --context {context} --image {image} -f {file} --commit-trigger-enabled {trigger_enabled} --pull-request-trigger-enabled {trigger_enabled} --assign-identity {identity}',
2025-04-07T15:27:04.9006200Z                  checks=[self.check('name', '{task_name}'),
2025-04-07T15:27:04.9006352Z                          self.check('location', '{rg_loc}'),
2025-04-07T15:27:04.9006496Z                          self.check('platform.os', 'linux'),
2025-04-07T15:27:04.9006643Z                          self.check('agentConfiguration.cpu', 2),
2025-04-07T15:27:04.9006805Z                          self.check('provisioningState', 'Succeeded'),
2025-04-07T15:27:04.9006956Z                          self.check('status', 'Enabled'),
2025-04-07T15:27:04.9007104Z                          self.check('timeout', 3600),
2025-04-07T15:27:04.9007254Z                          self.check('step.dockerFilePath', '{file}'),
2025-04-07T15:27:04.9007436Z                          self.check('step.imageNames', ['testtask:v1']),
2025-04-07T15:27:04.9007688Z                          self.check('step.arguments', []),
2025-04-07T15:27:04.9007842Z                          self.check('step.isPushEnabled', True),
2025-04-07T15:27:04.9007993Z                          self.check('step.noCache', False),
2025-04-07T15:27:04.9008138Z                          self.check('step.type', 'Docker'),
2025-04-07T15:27:04.9008296Z                          self.check('identity.type', 'SystemAssigned')]),
2025-04-07T15:27:04.9008429Z     
2025-04-07T15:27:04.9008562Z         # Create a contextless task using cmd.
2025-04-07T15:27:04.9008744Z         self.cmd('acr task create -n {task_no_context_cmd} -r {registry_name} --cmd {existing_image} -c {no_context}',
2025-04-07T15:27:04.9008940Z                  checks=[self.check('name', '{task_no_context_cmd}'),
2025-04-07T15:27:04.9009093Z                          self.check('location', '{rg_loc}'),
2025-04-07T15:27:04.9009244Z                          self.check('platform.os', 'linux'),
2025-04-07T15:27:04.9009395Z                          self.check('agentConfiguration.cpu', 2),
2025-04-07T15:27:04.9009555Z                          self.check('provisioningState', 'Succeeded'),
2025-04-07T15:27:04.9009705Z                          self.check('status', 'Enabled'),
2025-04-07T15:27:04.9009847Z                          self.check('timeout', 3600),
2025-04-07T15:27:04.9009997Z                          self.check('step.type', 'EncodedTask')])
2025-04-07T15:27:04.9010122Z     
2025-04-07T15:27:04.9010262Z         # Show version is correctly added to cmd created encoded task.
2025-04-07T15:27:04.9010440Z         # cannot decode the encodedTaskContent in check, compare the base64 encoded value directly.
2025-04-07T15:27:04.9010633Z         self.cmd('acr task show -n {task_no_context_cmd} -r {registry_name}',
2025-04-07T15:27:04.9010886Z                 checks=[self.check('step.encodedTaskContent', 'dmVyc2lvbjogdjEuMS4wCnN0ZXBzOiAKICAtIGNtZDogYmFzaAogICAgZGlzYWJsZVdvcmtpbmdEaXJlY3RvcnlPdmVycmlkZTogdHJ1ZQogICAgdGltZW91dDogMzYwMAo=')])
2025-04-07T15:27:04.9011094Z     
2025-04-07T15:27:04.9011225Z         # Create a contextless task using file.
2025-04-07T15:27:04.9011405Z >       self.cmd('acr task create -n {task_no_context_file} -r {registry_name} -f {file_path} -c {no_context}',
2025-04-07T15:27:04.9011671Z                  checks=[self.check('name', '{task_no_context_file}'),
2025-04-07T15:27:04.9011823Z                          self.check('location', '{rg_loc}'),
2025-04-07T15:27:04.9011974Z                          self.check('platform.os', 'linux'),
2025-04-07T15:27:04.9012121Z                          self.check('agentConfiguration.cpu', 2),
2025-04-07T15:27:04.9012281Z                          self.check('provisioningState', 'Succeeded'),
2025-04-07T15:27:04.9012432Z                          self.check('status', 'Enabled'),
2025-04-07T15:27:04.9012579Z                          self.check('timeout', 3600),
2025-04-07T15:27:04.9012724Z                          self.check('step.type', 'EncodedTask')])
2025-04-07T15:27:04.9012794Z 
2025-04-07T15:27:04.9012965Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/tests/latest/test_acr_task_commands.py:75: 
2025-04-07T15:27:04.9013165Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-07T15:27:04.9013342Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/testsdk/base.py:176: in cmd
2025-04-07T15:27:04.9013543Z     return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
2025-04-07T15:27:04.9013754Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/testsdk/base.py:251: in __init__
2025-04-07T15:27:04.9013949Z     self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
2025-04-07T15:27:04.9014152Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/testsdk/base.py:314: in _in_process_execute
2025-04-07T15:27:04.9014320Z     raise ex.exception
2025-04-07T15:27:04.9014482Z /usr/lib64/az/lib/python3.9/site-packages/knack/cli.py:233: in invoke
2025-04-07T15:27:04.9014845Z     cmd_result = self.invocation.execute(args)
2025-04-07T15:27:04.9015043Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py:666: in execute
2025-04-07T15:27:04.9015206Z     raise ex
2025-04-07T15:27:04.9015373Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py:734: in _run_jobs_serially
2025-04-07T15:27:04.9015570Z     results.append(self._run_job(expanded_arg, cmd_copy))
2025-04-07T15:27:04.9015754Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py:703: in _run_job
2025-04-07T15:27:04.9015927Z     result = cmd_copy(params)
2025-04-07T15:27:04.9016119Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py:336: in __call__
2025-04-07T15:27:04.9016292Z     return self.handler(*args, **kwargs)
2025-04-07T15:27:04.9016477Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py:120: in handler
2025-04-07T15:27:04.9016647Z     return op(**command_args)
2025-04-07T15:27:04.9016826Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/task.py:137: in acr_task_create
2025-04-07T15:27:04.9016996Z     step = create_task_step(
2025-04-07T15:27:04.9017178Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/task.py:292: in create_task_step
2025-04-07T15:27:04.9017353Z     yaml_template = get_yaml_template(
2025-04-07T15:27:04.9017508Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-07T15:27:04.9017575Z 
2025-04-07T15:27:04.9017698Z cmd_value = None, timeout = 3600
2025-04-07T15:27:04.9017886Z file = '/usr/lib/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/tests/latest/taskfilesample.yaml'
2025-04-07T15:27:04.9017982Z 
2025-04-07T15:27:04.9018126Z     def get_yaml_template(cmd_value, timeout, file):
2025-04-07T15:27:04.9018271Z         """Generates yaml template
2025-04-07T15:27:04.9018446Z         :param str cmd_value: The command to execute in each step. Task version defaults to v1.1.0
2025-04-07T15:27:04.9018627Z         :param str timeout: The timeout for each step
2025-04-07T15:27:04.9018786Z         :param str file: The task definition
2025-04-07T15:27:04.9018910Z         """
2025-04-07T15:27:04.9019113Z         yaml_template = ""
2025-04-07T15:27:04.9019267Z         # The default version is required to be added to cmd source Task.
2025-04-07T15:27:04.9019443Z         # The version is expeced to be included in the file for file source Task.
2025-04-07T15:27:04.9019598Z         if cmd_value:
2025-04-07T15:27:04.9019733Z             yaml_template += "version: v1.1.0\n"
2025-04-07T15:27:04.9019919Z             yaml_template += "steps: \n  - cmd: {0}\n    disableWorkingDirectoryOverride: true\n".format(cmd_value)
2025-04-07T15:27:04.9020082Z             if timeout:
2025-04-07T15:27:04.9020229Z                 yaml_template += "    timeout: {0}\n".format(timeout)
2025-04-07T15:27:04.9020365Z         else:
2025-04-07T15:27:04.9020483Z             if not file:
2025-04-07T15:27:04.9020629Z                 file = ACR_TASK_YAML_DEFAULT_NAME
2025-04-07T15:27:04.9020753Z     
2025-04-07T15:27:04.9020871Z             if file == "-":
2025-04-07T15:27:04.9020989Z                 import sys
2025-04-07T15:27:04.9021130Z                 for s in sys.stdin.readlines():
2025-04-07T15:27:04.9021266Z                     yaml_template += s
2025-04-07T15:27:04.9021385Z             else:
2025-04-07T15:27:04.9021518Z                 if os.path.exists(file):
2025-04-07T15:27:04.9021646Z                     f = open(file, 'r')
2025-04-07T15:27:04.9021773Z                     for line in f:
2025-04-07T15:27:04.9021900Z                         yaml_template += line
2025-04-07T15:27:04.9022027Z                 else:
2025-04-07T15:27:04.9022164Z >                   raise CLIError("{0} does not exist.".format(file))
2025-04-07T15:27:04.9022371Z E                   knack.util.CLIError: /usr/lib/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/tests/latest/taskfilesample.yaml does not exist.
2025-04-07T15:27:04.9022559Z 
2025-04-07T15:27:04.9022771Z /usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/acr/_utils.py:273: CLIError

https://dev.azure.com/azclitools/public/_build/results?buildId=233075&view=logs&jobId=53b5e140-cff2-558f-049b-6067e7c3cd03&j=176f2c7f-ce84-5d8e-0221-df7098ffc93b&t=efd733a2-e4f5-577c-7bba-7734b0ad5aac

@zhoxing-ms
Copy link
Contributor

zhoxing-ms commented Apr 8, 2025

@wju-MSFT Could you add a data folder under the acr/tests/latest directory and move the test file taskfilesample. yaml to the data folder to solve this issue?
Because currently, the files with the .yaml suffix in the current directory cannot be packaged. This is the related logic

package_data={'': ['*.bat',
'*.byok',
'*.cer',
'*.gql', # graphql used by apim
'*.js',
'*.json',
'*.kql',
'*.md',
'*.pem',
'*.pfx',
'*.sql',
'*.txt',
'*.txt',
'*.xml',
'*.yml',
'*.zip',
'**/*.bat',
'**/*.byok',
'**/*.cer',
'**/*.gql',
'**/*.ipynb',
'**/*.jar',
'**/*.js',
'**/*.json',
'**/*.kql',
'**/*.md',
'**/*.pem',
'**/*.pfx',
'**/*.sql',
'**/*.txt',
'**/*.txt',
'**/*.xml',
'data/*',
'recordings/*.yaml']},

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

Labels

Auto-Assign Auto assign by bot Container Registry az acr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACR task will append one extra line to the manifest

5 participants