Azure-cli: AZ ACR TASK CREATION ERROR: Traceback (most recent call last):

Created on 3 Jul 2020  路  11Comments  路  Source: Azure/azure-cli

Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 711, in _run_job
    six.reraise(*sys.exc_info())
  File "/opt/az/lib/python3.6/site-packages/six.py", line 703, in reraise
    raise value
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 545, in default_command_handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acr/task.py", line 200, in acr_task_create
    task_create_parameters=task_create_parameters)
  File "/opt/az/lib/python3.6/site-packages/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py", line 265, in create
    **operation_config
  File "/opt/az/lib/python3.6/site-packages/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py", line 215, in _create_initial
    raise models.ErrorResponseException(self._deserialize, response)
azure.mgmt.containerregistry.v2019_06_01_preview.models._models_py3.ErrorResponseException: Operation returned an invalid status code 'Not Found'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/az/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/az/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/__main__.py", line 44, in <module>
    exit_code = cli_main(az_cli, sys.argv[1:])
  File "/opt/az/lib/python3.6/site-packages/azure/cli/__main__.py", line 31, in cli_main
    return cli.invoke(args)
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 226, in invoke
    exit_code = self.exception_handler(ex)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 106, in exception_handler
    return handle_exception(ex)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/util.py", line 94, in handle_exception
    error = response_dict['error']
TypeError: string indices must be integers

WHILE CREATING ACR TASKER

az acr task create --registry stagingregistry --name staging --image rstagingregistry.azurecr.io/rstage:{{.Run.ID}} --image stagingregistry.azurecr.io/stage:latest --context https://github.com/SANDEEP/STAGING-app.git#Devops --file Dockerfile --git-access-token xyz

Container Registry Service Attention customer-reported

Most helpful comment

@sandeepmindwave , thanks for the report. To make it work, you need enable either the commit-trigger or base-image trigger when using the git-access-token. It works if adding "--commit-trigger-enabled false --base-image-trigger-enabled true" in the end of your command. But there's a bug in our side, it should give you the clear error message.

All 11 comments

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @toddysm, @yugangw-MSFT.

ACR

Please investigate

@sandeepmindwave , thanks for the report. To make it work, you need enable either the commit-trigger or base-image trigger when using the git-access-token. It works if adding "--commit-trigger-enabled false --base-image-trigger-enabled true" in the end of your command. But there's a bug in our side, it should give you the clear error message.

@yugangw-msft I filed another issue by my investigation. When the status is not expected, it is supposed to throw the error detail. But the cli util failed to parse the error from the ex response.

@sandeepmindwave , thanks for the report. To make it work, you need enable either the commit-trigger or base-image trigger when using the git-access-token. It works if adding "--commit-trigger-enabled false --base-image-trigger-enabled true" in the end of your command. But there's a bug in our side, it should give you the clear error message.

It works for me.

Hi is there any progress on this?

While --commit-trigger-enabled false --base-image-trigger-enabled true

--commit-trigger-enabled true doesn't work, so it seems I can't create a task with a commit trigger enabled?

@timja The commit trigger works. The above issue is caused by an invalid git-access-token I think. We have problem to parse the error as the issue filed in https://github.com/Azure/azure-cli/issues/14343. It works if everything is right.

14830

The actual issue in my case was that the PAT I was using didn鈥檛 have admin access to the repo

@sandeepmindwave , thanks for the report. To make it work, you need enable either the commit-trigger or base-image trigger when using the git-access-token. It works if adding "--commit-trigger-enabled false --base-image-trigger-enabled true" in the end of your command. But there's a bug in our side, it should give you the clear error message.

@huanwu thanks for replay , i am facing new issue, this command working**--commit-trigger-enabled false --base-image-trigger-enabled true** but auto trigger is not working while i get new commit tasker is not running

Was this page helpful?
0 / 5 - 0 ratings

Related issues

williexu picture williexu  路  3Comments

PrHar picture PrHar  路  3Comments

oakeyc picture oakeyc  路  3Comments

rlewkowicz picture rlewkowicz  路  3Comments

Kannaj picture Kannaj  路  3Comments