-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
{AzureContainerApp} az containerapp create --bind "my-app" throws error when service has dashes in the name "-" #6530
Conversation
️✔️Azure CLI Extensions Breaking Change Test
|
Hi @navba-MSFT, |
AzureContainerApp |
@Greedygre Could you please help review this PR? |
@@ -467,7 +467,7 @@ def process_service(cmd, resource_list, service_name, arg_dict, subscription_id, | |||
|
|||
|
|||
def validate_binding_name(binding_name): | |||
pattern = r'^(?=.{1,60}$)[a-zA-Z0-9._]+$' | |||
pattern = r'^(?=.{1,60}$)[a-zA-Z0-9._-]+$' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a message for this validate_binding_name
, I'm not sure this binding name is available if it contains -
raise InvalidArgumentValueError("The Binding Name can only contain letters, numbers (0-9), periods ('.'), "
"and underscores ('_'). The length must not be more than 60 characters.")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @yash-nisar Do you know whether the binding name can contains -
?
Hi @yash-nisar |
@yash-nisar @Greedygre Please let me know if you had a chance to look into this. |
Currently, while using --bind, we expect the user to provide us the svc_name:[binding_name] where the binding_name is optional and the binding_name should follow "The Binding Name can only contain letters, numbers (0-9), periods ('.'), and underscores ('_'). The length must not be more than 60 characters." because this is what service linker expects. If we have a svc_name that has a "-", we use the same as our binding_name and ask the user to provide an acceptable binding_name. Since binding_names would appear in env vars, we cannot allow "-" in the binding_name plus service linker doesn't accept it. IMO, this PR will break stuff and a more longer term solution should be pondered upon:
CC @duglin |
There were talks going on about how to handle it and there is an issue on the same: https://github.com/orgs/serverless-paas-balam/projects/2/views/1?pane=issue&itemId=34057347 |
From a DevEx perspective, customers already face significant challenges naming azure resources. Some allow non-alphanumeric chars and some don't some allow uppercase, and some don't. It's the wild west out there. The current model, allowing them to give something a name that will prevent future functionality is obviously broken. Ideally, I would like to see "Azure" support the same naming conventions on every service, so customers don't have to have special knowledge of a resource in order to provide a name for it. But I fear that would lead us to only allowing lowercase, alphanumeric chars which are harder for humans to read. I'm also concerned about the idea of "restricting dev service names", but perhaps it'd due to a lack of understanding on my part. I need to better understand what exactly a "dev service" refers to because it seems to me what I'm passing to --bind is just the name of a container app. I do like the idea of supporting a compliant binding name that differs from the container app name, and I believe most developers wouldn't have a problem with swapping the invalid "-" char for "_". But I would also give them the opportunity to specify the binding name themself - perhaps with an optional |
But I would also give them the opportunity to specify the binding name themself - perhaps with an optional --bindng_name param that allows them to be explicit if needed.
That’s already supported today on the --bind flag: `--bind SERVICE_NAME[:BINDING_NAME]`
It’s just optional.
|
ok, I feel a bit foolish for not figuring that out, but in my feeble defense it doesn't just leap off the page (see screenshot below). Perhaps a simple fix, while the team considers other options, is to just update the error message to let the user know they can specify their own binding name: from this:
to this:
|
I will close this PR for now and created the below PR to address this ask. |
fixes #6524
Container Apps lets me create a container with dashes ("-") in the name, but then I can't reference that container in the --bind parameter. so I expect the command to accept the service with a dash in the name because I was allowed to create it in the first place.
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>
locally? (pip install azdev
required)python scripts/ci/test_index.py -q
locally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.json
automatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json
.