Environment variables with dots

It is not possible to set environment variables with dots in their name.
If you try to set one in the UI, it just does not work without error message.
If you try to set one via circle.yml, the build status page says it sets it, but it is not set.
This is necessary for example to inject gradle.publish.key via environment variable ORG_GRADLE_PROJECT_gradle.publish.key into a Gradle build.

As workaround you have to set some environment variable that has no dots and then set the project property from that environment variable in your build script, but it would be better if the variable could be set.

Hello @Vampire,

Where you able to get this to work by setting the variable with quotes in the UI settings?

Hi @zzak,

no. No matter whether I try to enter with double quotes, single quotes, backslash-escaped dot or anything else. the Add variable button changes to Failed without any further info and that’s it.

Also, even if the UI would let me stuff it in, I guess the setting would fail like it does when you try to set it from circle.yml.

We use Bash, which follows the POSIX naming convention for environment variables. Basically, uppercase and lowercase letters, digits, and the underscore are allowed. With the added rule that the first character should be a letter.

1 Like

Well, the standard says

These strings have the form name=value; names shall not contain the character β€˜=’. For values to be portable across systems conforming to IEEE Std 1003.1-2001, the value shall be composed of characters from the portable character set (except NUL and as indicated below).

So any character except of = and NUL are valid names for environment variables.

The standard furthermore says

Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the β€˜_’ (underscore) from the characters defined in Portable Character Set and do not begin with a digit. Other characters may be permitted by an implementation; applications shall tolerate the presence of such names. Uppercase and lowercase letters shall retain their unique identities and shall not be folded together. The name space of environment variable names containing lowercase letters is reserved for applications. Applications can define any environment variables with names from this name space without modifying the behavior of the standard utilities.

So the standard just defines what utilities volume of the standard use as names and Bash just only supports these characters (uppercase, lowercase, underscore, numbers). But the environment variable names with other characters are perfectly vaild according to the standard. This also explains why using the env utililty you can perfectly fine set environment variables with dots in their names.

So this can actually be seen as bug, that you do not support all valid environment variable names.

Even if you will not support vaild environment variable names, you should at least fix that it seems as the variable is set if it is defined in circle.yml. As you can see at https://circleci.com/gh/Vampire/gradle-semantic-build-versioning/119#config/containers/0, CircleCI says it set the environment variable and does not give any indication that it did not work, yet it did not work.

But please support this perfectly valid use-case.

Have you tried this on 2.0 yet?

@zzak I just tried with current CircleCI and it still does not allow to set environment variables that have a dot in them via the Web UI, the Ajax call returns {"message":"The variable name 'ORG_GRADLE_PROJECT_gradle.publish.key' is invalid"} or {"message":"The variable name '"ORG_GRADLE_PROJECT_gradle.publish.key"' is invalid"} if tried with quotes as you suggested earlier. And also setting from circle.yml still behaves the same, the Web UI states it exports the variable, but it is not set effectively.

+1 with the same problem on v2