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

Improve ext_sequencing failed deployment regex #3206

Merged
merged 3 commits into from
Sep 9, 2024

Conversation

maddieford
Copy link
Contributor

Description

The ext_sequencing scenario deploys arm templates and expects some deployments to fail. The scenario checks that the deployment failure is expected using a regex. The regex is currently capturing the last failure in the deployment details (which works in some cases but fails in others).

An example of a case where the last failure is not the failure we want to capture (DeploymentOutputEvaluationSkipped is not the failure we care about):

(DeploymentFailed) At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.
Code: DeploymentFailed
Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.
Exception Details: (Conflict) {
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.",
"details": [
{
"code": "VMExtensionProvisioningError",
"target": "0",
"message": "Multiple VM extensions failed to be provisioned on the VM. The Extensions failed due to the errors: \n[Extension Name: 'AzureMonitorLinuxAgent'\nError Message: VM Extension 'AzureMonitorLinuxAgent' is marked as failed since it depends upon the VM Extension 'CustomScript' which has failed.]\n\n[Extension Name: 'CustomScript'\nError Message: VM has reported a failure when processing extension 'CustomScript' (publisher 'Microsoft.Azure.Extensions' and type 'CustomScript'). Error message: 'Enable failed: failed to execute command: command terminated with exit status=1\n[stdout]\n\n[stderr]\n'. More information on troubleshooting is available at https://aka.ms/VMExtensionCSELinuxTroubleshoot. ]\n"
}
]
}
}
Code: Conflict
Message: {
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.",
"details": [
{
"code": "VMExtensionProvisioningError",
"target": "0",
"message": "Multiple VM extensions failed to be provisioned on the VM. The Extensions failed due to the errors: \n[Extension Name: 'AzureMonitorLinuxAgent'\nError Message: VM Extension 'AzureMonitorLinuxAgent' is marked as failed since it depends upon the VM Extension 'CustomScript' which has failed.]\n\n[Extension Name: 'CustomScript'\nError Message: VM has reported a failure when processing extension 'CustomScript' (publisher 'Microsoft.Azure.Extensions' and type 'CustomScript'). Error message: 'Enable failed: failed to execute command: command terminated with exit status=1\n[stdout]\n\n[stderr]\n'. More information on troubleshooting is available at https://aka.ms/VMExtensionCSELinuxTroubleshoot. ]\n"
}
]
}
} (Conflict) {
"error": {
"code": "DeploymentOutputEvaluationSkipped",
"message": "Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details."
}
}
Code: Conflict
Message: {
"error": {
"code": "DeploymentOutputEvaluationSkipped",
"message": "Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details."
}
}

This PR updates the regex to be stricter. Now the regex only matches failure with code 'ResourceDeploymentFailure'

Issue #


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made

Quality of Code and Contribution Guidelines

# ]
# }
# }
deployment_failure_pattern = r"[\s\S]*Exception Details:\t\(Conflict\) {\s*" \
Copy link
Member

Choose a reason for hiding this comment

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

the regex looks way too specific, possibly breaking if the message is slightly changed. should we parse the json instead and check the properties we are interested in?

@maddieford maddieford merged commit ca906fa into Azure:develop Sep 9, 2024
11 checks passed
@maddieford maddieford deleted the ext_seq_regex branch September 9, 2024 18:51
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