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

Wait and Retry decorators with Experimental Feature Flag Enabled #16167

Merged
merged 13 commits into from
Feb 3, 2025

Conversation

subha-sa
Copy link
Contributor

@subha-sa subha-sa commented Jan 21, 2025

Users are facing issues with certain RPs (example SRP), where due to latency in replication or RP itself responded with success even before the resource is ready for use.

In such a case, dependent resource deployments fail, because the resource isn't available according to ARM or some properties of the resource isn't available like list keys for example. Issue thread for reference.

For overcoming this issue WaitUntil and RetryOn decorators are being introduced, that can apply to resource types. WaitUntil, will wait for the resource to be ready until certain properties are set to desired value, while RetryOn will retry the resource deployment when listed error codes are encountered

Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

github-actions bot commented Jan 21, 2025

Test this change out locally with the following install scripts (Action run 13120868645)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 13120868645
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 13120868645"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 13120868645
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 13120868645"

Copy link
Contributor

github-actions bot commented Jan 30, 2025

Dotnet Test Results

    78 files   -     39      78 suites   - 39   32m 36s ⏱️ - 15m 11s
11 722 tests +    31  11 722 ✅ +    31  0 💤 ±0  0 ❌ ±0 
27 202 runs   - 13 386  27 202 ✅  - 13 386  0 💤 ±0  0 ❌ ±0 

Results for commit 854e85c. ± Comparison against base commit 3c802a3.

This pull request removes 1870 and adds 717 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�ӽ\u000e�0\u0010\u0007��>\u0005OP�蕃���Wh�ďP\u000c�Hb|w�`�\u0000qA0����K���e�3��4��i�\u0002�b)�\u0006^J4z>@�\u0002�\u0005\u0004�� D��>Ɉ�u��,q�\u000fJ�ȸSU\u0016�*S�)gI
��|�k��\u001aFW�Eg/��Yynk;4TS
k?4\u0018����Zѧ�\u0003$\u0002��\u0015�F��G5���L�y�'\u0008� \u0008��\u0004X\u0007\u0011>\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�Ի
�0\u0014\u0006��>E�\u0003���
\u001d\u0004\u0007+R\u0005�U�
X�U�
\u0005_�t\u0010�\u0016�^\u0004�9\u0007r��\u0007�{]��NLQ"���G�oؒ���7��\u0011��\u0001VBP\u0000`��$-\u001ee�\u000b;�\u0018{� ����̄D�9S�\u0007
qI��3[:w�H\u0000ﺺ�i��\u001a]�[�tg\u001d�S����y��n�[�1���+�� \u0004`)�n8J&�<�O/���m�:m\u000e��[@�\u0003O=��8�3�\u0017�C"�\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�Խ\u000e�0\u0010\u0000��>E�\u0003��-\u0014L�]L\|�
g�\u0008\u0012�	���-�q���cb��wI��^����\u0016u��a\u0002d�326�B){�;\*��\u001b\u0010PA\u0010\u0010B��+�q7��m)s����\u0011�M^`���m<\u0000�\u0002x\u0018�+\u001bK�b<��n�I^fز���]z1���1�\u0001����E��\u001f�$�\u000f�J\u0000\u0004\\u0012\u0008�۱�?�L���?�w(��0m0�aq���Г�\u001a|.]��8�3�\u0017��\u001e�\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003�ӽ
�0\u0010\u0007��}
� �y\u0017�Žc_!�B?0\u0016�T(}�ơ�A�b�����8�B��tg�mi\u000fe�J�\u0019R)�\u0006A�<z?@�\u0002�\u000b\u0008Њs!�~�MFt��MXe�Y?(3����,P�!��\u0018	F�\u0003oBm?Y��j������7'�m톆j�a�F����[3>�\u001f \u0013Ț5\u0001\u0010q�?\u0012��/��?�����\u0006Q\u0014E�\u001a���\u0008�\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003���
�0\u000c\u0000М���\u000f�RӭU�A��DT\u0010�Jq\u0003'Le�0��\u0007��eS��c\u0013HJH��6�,5IZ��B�>���\u0015J��� �\u0002��\u0010P\u0005\u0001\u0001���N\u001a\��\u0014��O��AC�L��i$\u0014iR\u0001i�\u0005��Z
ll�\u0016\u0013#v1�!�NIZ�cy>=���o��i�_�5��?\u000e%�\u001b \u0015!\u0012I�0�\u0017\u0001�Gv��������d\u0011Ow��j鍙�����q\u001c���\u001d<�Z�\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003���
�0\u000c\u0000О���\u0007�vi�*��E��\u0007�-��ͱN\u0018��n=��
/n\u0013�;�&�����ֶk�\u0019֎A,���o�^,e�����\u0008��	�J\u0001!���$\u001d����\u001fe�^?(2�6y���`@+0��\u0008@\u001b3�/'����1��\u000c[vr��Y^��O}͠������i�9H��\u0000���>�R~\u001f�(;������]�m�i��\u0006�=��\u0015=س��Գ\u0005A\u0010\u0004�y\u0000W\u000f��\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Repository_not_found_in_registry (ArtifactRegistryAddress { RegistryAddress = mcr.microsoft.com, RepositoryPath = unknown/path/az, ExtensionVersion = 0.0.0-placeholder },Azure.RequestFailedException: The artifact does not exist in the registry.,[(BCP192, Error, Unable to restore the artifact with reference "br:mcr.microsoft.com/unknown/path/az:0.0.0-placeholder": The artifact does not exist in the registry.)])
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Repository_not_found_in_registry (ArtifactRegistryAddress { RegistryAddress = unknown.registry.azurecr.io, RepositoryPath = bicep/extensions/az, ExtensionVersion = 0.0.0-placeholder },System.AggregateException: Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)),[(BCP192, Error, Unable to restore the artifact with reference "br:unknown.registry.azurecr.io/bicep/extensions/az:0.0.0-placeholder": Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)))])
Bicep.Core.IntegrationTests.DecompilationTests ‑ Decompiler_handles_banned_function_replacement ("createArray(1, 2, 3)","array","[
  1
  2
  3
]")
Bicep.Core.IntegrationTests.DecompilationTests ‑ Decompiler_handles_banned_function_replacement ("createObject('key', 'value')","object","{
  key: 'value'
}")
…

♻️ This comment has been updated with latest results.

@subha-sa subha-sa requested review from majastrz and jeskew January 30, 2025 19:59
@subha-sa subha-sa requested a review from jeskew January 31, 2025 00:16
Copy link
Member

@majastrz majastrz left a comment

Choose a reason for hiding this comment

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

:shipit:

@subha-sa subha-sa merged commit 21a1f16 into main Feb 3, 2025
47 checks passed
@subha-sa subha-sa deleted the susamban/waitandretry branch February 3, 2025 19:02
subha-sa added a commit that referenced this pull request Feb 27, 2025
…decorators (#16342)

This is an incremental PR that introduces the `WaitUntil` and `RetryOn`
decorators to the Bicep language.
The PR introduces changes for the following decorators. 

WaitUntil is used on resource data type.

RetryOnAll and WaitUntilAll are decorators used on collection resource
data type.


Context:
Users are facing issues with certain RPs (example SRP), where due to
latency in replication or RP itself responded with success even before
the resource is ready for use.

In such a case, dependent resource deployments fail, because the
resource isn't available according to ARM or some properties of the
resource isn't available like list keys for example.
#1013 for reference.

Previous PR
#16167 
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/16342)

---------

Co-authored-by: Subha Sambandamurthy <susamban@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants