Azure / simdem

Tool for Simulating Demo's, delivering Tutorials and using documentation as tests.
MIT License
34 stars 17 forks source link

Simdem does not execute indented code samples #120

Closed jasonmesser7 closed 2 years ago

jasonmesser7 commented 2 years ago

When bash commands are indented in a sequence of numbers, they do not execute. the parser skips over them. See Screenshot

image

For Repro use the following code from raw text

Add custom domain to AGIC

Now that Application Gateway Ingress has been added, the next step is to add a custom domain. This will allow the endpoint to be reached by a human readable URL as well as allow for SSL Termination at the endpoint.

  1. Store Unique ID of the Public IP Address as an environment variable by running the following:

    export PUBLIC_IP_ID=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP_ADDRESS')].[id]" --output tsv)
  2. Update public IP to respond to custom domain requests by running the following:

    az network public-ip update --ids $PUBLIC_IP_ID --dns-name $CUSTOM_DOMAIN_NAME
rgardler-msft commented 2 years ago

If you have this in a doc can you validate that this isn't caused by the bash text after the backticks (this should be supported anyway). Can you also check to see if it is indentation (which also should be supported).

jasonmesser7 commented 2 years ago

Validating the bug here - See screenshot. image

The bash tag is not an issue as demonstrated above.

This is an important one to fix as most documents will have indented content so that it is human readable

rgardler-msft commented 2 years ago

Thanks for validating the bash​ item, what about the indents.

Agree it needs fixing (hence the bug tag), just trying to ascertain exactly what the fix is.


From: jasonmesser7 @.> Sent: Monday, July 11, 2022 15:05 To: Azure/simdem @.> Cc: Ross Gardler (HE/THEY) @.>; Comment @.> Subject: Re: [Azure/simdem] Simdem does not execute indented code samples (Issue #120)

Validating the bug here - See screenshot. [image]https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F91570951%2F178366595-0b77fc09-b713-446a-aa09-8452226d7ad2.png&data=05%7C01%7Cross.gardler%40microsoft.com%7C4981cc6b3c984243345d08da63896a46%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637931739090355630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GNzCXIAfdvnPCzEU1XbriWZrZv3Y6GH59vs%2BKB29C34%3D&reserved=0

This is an important one to fix as most documents will have indented content so that it is human readable

— Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fsimdem%2Fissues%2F120%23issuecomment-1180914817&data=05%7C01%7Cross.gardler%40microsoft.com%7C4981cc6b3c984243345d08da63896a46%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637931739090355630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pXRmZMt2KqQo6P0BtwN5emQqmm6CiCGGLXhPuiKVOHI%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAZ5Z7CXLLARNPOZ3AM75AFLVTSLBFANCNFSM53CMW3EQ&data=05%7C01%7Cross.gardler%40microsoft.com%7C4981cc6b3c984243345d08da63896a46%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637931739090355630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mi%2FCk%2FH604mvKn6XV0nnIJqhUIsvmUCPbPmTpIjqiZ4%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

jasonmesser7 commented 2 years ago

I may be misunderstanding, but I believe the screen shot as well also validates the indents. The second line is a usual bash item which is indented which does not work.

In my testing it does not even need to be in a sequence of numbers. Any code lines which are indented will be skipped.

Let me know if there is a anything else I can do to help clarify.

rgardler-msft commented 2 years ago

You are right it tests indents. I only saw the removal of "bash".

When writing tests like this can we put them in https://github.com/Azure/simdem/tree/main/demo_scripts/simdem so that we can a) it is documented that we can indent code blocks b) confirm that it gets fix and c) avoid regressions. What you have here is almost there, just needs a result section and the wording will need to change to documentation rather than bug.

Committing when committing to the repo flag it as "test case for #120" in the commit message and it will be linked here and start causing the badge on the main repo page to show as failing.