Page MenuHomePhabricator

[envvars-api, envvars-cli] Create envvar name error message is not user friendly
Open, LowPublic

Description

Upon running toolforge-envvars create [name], when the user's provided [name] does not meet a specific criteria, they get a non user-friendly error in the following steps, which complicates troubleshooting.

toolforge envvars create [name]
Enter the value of your envvar: [value] 
**Error: parameter "name" in path has an error: string doesn't match the regular expression "^[A-Z_][A-Z_0-9]{3,}$"**

Suggestion:
This error should be in plain english and not regex. i.e. "Must use an upper-case letters only, name input should be longer than x characters.. "

Event Timeline

Slst2020 renamed this task from [envvars-cli] Create envvar name error message is not user friendly to [envvars-api, envvars-cli] Create envvar name error message is not user friendly.Mar 15 2024, 6:52 AM
Slst2020 updated the task description. (Show Details)

The current error message probably comes from the envvars API that envvars-cli talks to. The repo is here: https://gitlab.wikimedia.org/repos/cloud/toolforge/envvars-api

This API is written in Go and generated by oapi-codegen from the openapi/v1.yaml file. The README has info about how to get started with this.

In lima-kilo, you will see envvars-api deployed in the local kubernetes cluster, inside the envvars-api namespace:

slavina@lima-lima-kilo:/home/slavina$ kubectl get all -n envvars-api
NAME                               READY   STATUS    RESTARTS   AGE
pod/envvars-api-6c698f78d5-rjc57   2/2     Running   0          7d23h

NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/envvars-api   ClusterIP   10.96.191.215   <none>        8443/TCP   7d23h

NAME                          READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/envvars-api   1/1     1            1           7d23h

NAME                                     DESIRED   CURRENT   READY   AGE
replicaset.apps/envvars-api-6c698f78d5   1         1         1       7d23h
dcaro triaged this task as Low priority.Mar 18 2024, 9:21 AM
dcaro subscribed.

Keep in mind though that the validation should be kept as much as possible on the API side, not the client.

If you want to debug inside the kubernetes cluster, lima-kilo comes with k9s that's a bit easier to use than plain kubectl.