Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az bicep build broken in CLI 2.22.0 #17665

Closed
IJsbrandVV opened this issue Apr 13, 2021 · 16 comments · Fixed by #17675
Closed

az bicep build broken in CLI 2.22.0 #17665

IJsbrandVV opened this issue Apr 13, 2021 · 16 comments · Fixed by #17675
Assignees
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Service Attention This issue is responsible by Azure service team.

Comments

@IJsbrandVV
Copy link

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug
Running az bicep build gives a python error:

The command failed with an unexpected error. Here is the traceback:
type object 'datetime.datetime' has no attribute 'fromisoformat'
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/__init__.py", line 807, in default_command_handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3294, in build_bicep_file   
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 63, in run_bicep_command    
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 152, in _load_bicep_version_check_result_from_cache
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'

To Reproduce

  • Upgrade to Azure CLI 2.22.0
  • Run az bicep build -f somefile.bicep

Expected behavior

Bicep build should work

Environment summary
Installed using az upgrade and repaired using the MSI. Both don't work.
Windows 10, x64. az bicep build command ran from a git bash terminal.

Additional context

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 13, 2021
@yonzhan yonzhan added the ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group label Apr 13, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 13, 2021
@yonzhan yonzhan added Service Attention This issue is responsible by Azure service team. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 13, 2021
@ghost
Copy link

ghost commented Apr 13, 2021

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure.

Issue Details

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug
Running az bicep build gives a python error:

The command failed with an unexpected error. Here is the traceback:
type object 'datetime.datetime' has no attribute 'fromisoformat'
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/__init__.py", line 807, in default_command_handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3294, in build_bicep_file   
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 63, in run_bicep_command    
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 152, in _load_bicep_version_check_result_from_cache
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'

To Reproduce

  • Upgrade to Azure CLI 2.22.0
  • Run az bicep build -f somefile.bicep

Expected behavior

Bicep build should work

Environment summary
Installed using az upgrade and repaired using the MSI. Both don't work.
Windows 10, x64. az bicep build command ran from a git bash terminal.

Additional context

Author: IJsbrandVV
Assignees: -
Labels:

ARM, Service Attention

Milestone: -

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 13, 2021

route to service team

@fluffy-cakes
Copy link

I get the same when trying to run a deployment via az deployment...

➜  mgmt_group: az deployment tenant create -l uksouth -f main.bicep
type object 'datetime.datetime' has no attribute 'fromisoformat'

➜  mgmt_group: python3

Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> from datetime import datetime
>>> datetime.fromisoformat('2021-04-13')
datetime.datetime(2021, 4, 13, 0, 0)

>>> datetime.
datetime.astimezone(        datetime.isoweekday(        datetime.timestamp(
datetime.combine(           datetime.max                datetime.timetuple(
datetime.ctime(             datetime.microsecond        datetime.timetz(
datetime.date(              datetime.min                datetime.today(
datetime.day                datetime.minute             datetime.toordinal(
datetime.dst(               datetime.month              datetime.tzinfo
datetime.fold               datetime.mro(               datetime.tzname(
datetime.fromisocalendar(   datetime.now(               datetime.utcfromtimestamp(
datetime.fromisoformat(     datetime.replace(           datetime.utcnow(
datetime.fromordinal(       datetime.resolution         datetime.utcoffset(
datetime.fromtimestamp(     datetime.second             datetime.utctimetuple(
datetime.hour               datetime.strftime(          datetime.weekday(
datetime.isocalendar(       datetime.strptime(          datetime.year
datetime.isoformat(         datetime.time(

>>> datetime._

I am running the deployment from a fresh build of my Docker container built this morning: https://github.com/fluffy-cakes/devops_tools/

@zhoxing-ms
Copy link
Contributor

@shenglol Could you please help to have a look at this issue~

@shenglol
Copy link
Contributor

@zhoxing-ms already submitted a PR: #17675. Can you take a look?

@shenglol
Copy link
Contributor

For those who get this error, please use the temporary workaround mentioned in Azure/bicep#2243 (comment) to the configure Azure CLI to use Python 3.8.

@IJsbrandVV
Copy link
Author

Just to be clear. While a PR has been closed, no new version of the Azure CLI has been released.

Can we just use 2.22.0 now or should we wait for a patch release 2.22.1?

@fluffy-cakes
Copy link

@IJsbrandVV , i noted that too, however the PR was pushed into the Dev branch, which i assume means will be in their backlog for the next release?

zhoxing-ms merged 1 commit into Azure:dev from shenglol:bicep-python3.6-fix 16 minutes ago

@shenglol
Copy link
Contributor

shenglol commented Apr 14, 2021

@yonzhan @zhoxing-ms would it be possible for us to get a hot fix release for this?

@zhoxing-ms
Copy link
Contributor

@IJsbrandVV @fluffy-cakes Yes, closing PR usually only means that the code in PR is merged into the dev branch, but the related code needs the next sprint to be released.
Maybe you can refer to the solution mentioned by shenglol as a workaround

@zhoxing-ms
Copy link
Contributor

@shenglol May I ask if this issue has a wide impact on users? If only a small number of users are affected, can they use the private package of edge build at first, and we will release it in the next sprint (05-04)?
If hotfix is necessary, what is the expected release time?

@zhoxing-ms
Copy link
Contributor

If you need to launch hotfix, please use the package of edge build to do test to ensure that the quality meets the expectation. And then we'll help you release the hotfix

@IJsbrandVV
Copy link
Author

@zhoxing-ms For now I have disabled automatic updates of the Azure CLI, uninstalled it and reinstalled 2.21.0

In my personal opinion an issue is not closed unless an actual fix has been released but w/e. I've warned our team not to upgrade and wait for the next release.

@IJsbrandVV
Copy link
Author

IJsbrandVV commented Apr 15, 2021

@zhoxing-ms @shenglol as for people affected I don't have an answer. I'm just a windows dev that doesn't have a local python installation (Our codebase is C# / typescript so why would I have python installed?) and use bicep. Everyone in that profile would have this issue and I've seen more and more issues pop up regarding this, i.e. #17700 #17694 and the bicep issue #2243 you linked already.

@zhoxing-ms
Copy link
Contributor

@IJsbrandVV Hi, we released a new version (2.22.1) of hotfix to address this issue today. Please upgrade CLI to the latest version (2.22.1) and try again.

@IJsbrandVV
Copy link
Author

That's great @zhoxing-ms

I just updated to the latest version and everything works again. Thanks for the quick response 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants