Update validation rule for workspace_variables
MR: Pending
Description
Background: Workspace variables are injected into a workspace as environment variables. We allow the users to specify these variables during workspace creation that they can later access inside the workspace. These variables are stored as a kubernetes secret which is then loaded into the workspace pod using the secretRef
.
Problem: Currently we allow the variable keys to have dots (.) and hyphens (-). Variables containing these characters are not injected into the pod because ENV variable names with these characters are not valid in the shell. (Source: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_231)
In the shell command language, a word consisting solely of underscores, digits, and alphabetics from the portable character set. The first character of a name is not a digit.
So we need to update the validation rule for workspace_variables to only allow alphanumeric characters and underscores in compliance with the naming convention of shell ENV variables and disallow special characters like hyphens(-)/dots(.) and also make sure that numbers are not allowed as the first character.
Additionally we should look into migrating existing variables with these invalid keys (if any) as it can be a problem if we attempt to update workspace_variables
data in the future with the new validation rule.
Acceptance criteria
-
Hyphens (-) not allowed -
Dots (.) not allowed -
Numbers as first character not allowed -
Migration to update/delete existing invalid keys