{Release} Hotfix: TS Multiline String Support for Template Inputs #15760
{Release} Hotfix: TS Multiline String Support for Template Inputs #15760yonzhan merged 7 commits intoAzure:releasefrom detienne20:daetienn/TSIssue37Expressions
Conversation
|
TS Multiline String Support |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
May I ask if there is a requirement in the design for template spec that it cannot be modified on the client side, but should be sent directly to the service side? |
@zhoxing-ms There is no requirement for this in Template Spec; template specs takes in a valid json object. |
| template_content = read_file_content(abs_local_path) | ||
| sanitized_template = _remove_comments_from_json(template_content) | ||
| template_json = json.loads(json.dumps(sanitized_template)) | ||
| template_json = json.loads(json.dumps(process_template(template_content))) |
There was a problem hiding this comment.
json.loads(json.dumps(
Why serialize and then deserialize the object from process_template() ? The data returned by process_template has been deserialized~
There was a problem hiding this comment.
data returned by process_template is a ordered dictionary due to shell_safe_json_parse, the template_json needs to be a json object.
Juliehzl
left a comment
There was a problem hiding this comment.
Could you add test for the scenario?
| displayName: 'Use Python 3' | ||
| inputs: | ||
| versionSpec: 3.x | ||
| versionSpec: 3.8 |
There was a problem hiding this comment.
You could revert this file as this PR #15804 has fixed the build issue
There was a problem hiding this comment.
Or merge from release to get a clear branch history.
Description
Customer reported template specs issue (Azure/template-specs#37) where the contents of multiline strings were replaced with #Azure CLI#. This was the result of the _remove_comments_from_json function used to process the template input. This function is typically used in deployments for processing template inputs; multiline strings are processed to prompt for parameters. The full functionality is not needed for creating a template spec from a template input therefore the function has been replaced by process_template_spec in _packing_engine.py.
Example:
Template Input:
{
"variables": {
"myVar": "[if(equals(parameters('kind'), ''),
variables('resources')[variables('provider')][variables('resourceType')],
variables('resources')[variables('provider')][variables('resourceType')][parameters('kind')]))]"
}
}
Template Specs Created:
{
"variables": {
"myVar": "#Azure Cli#"
}
}
Testing Guide
az ts create -g resource_group --name Issue37 -v 1.0 -l westus --template-file original.json
--> Multiline strings starting on lines 2644, 2657, and 2661 should not be replaced by "#Azure CLI#"
-->Can compare template spec created with postTsCreation.json (showcases issue).
Issue37Templates.zip