The format of key of containerEnvVar within Jenkins Kubernetes Plugin

94 views
Skip to first unread message

WANG, YAN-HONG

unread,
Aug 9, 2017, 4:07:40 AM8/9/17
to jenkins...@googlegroups.com
Hello,

I am Hong.

I saw "containerEnvVar" was supported by Jenkins Kubernetes Plugin 0.9.
But, it seems not support some key value with dot?

Example in containerTemplate:
containerEnvVar( key: “data.source.url”, value: “somewhere” )

I tried to use backslash to escape dot, but Jenkins parser doesn't pass it.

Someone has idea?

Thanks very much.

Best regards,
Hong

Carlos Sanchez

unread,
Aug 10, 2017, 3:09:08 PM8/10/17
to Jenkins Users
You can not use dots in an environment variable

https://kubernetes.io/docs/api-reference/v1.6/#envvar-v1-core

a valid C identifier must start with alphabetic character or '_', followed by a string of alphanumeric characters or '_'


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CADLWyO1jrOYcJzMgBFZvMy0uENVjMORJsrSr%3DUoi%2Bf%2B-jGP-dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

YAN-HONG WANG

unread,
Aug 11, 2017, 10:27:24 AM8/11/17
to Jenkins Users
Hello Carlos,

Thanks for hint.

But, something interesting is if I set this environment variable into Dockerfile.
That's worked.

Looks like:
ENV data.source.url SomeWhere_A

I could see data.source.url existed when this Docker container run.
That environment variable even could be saw when this Docker container run in Kubernetes.

By the way, you are right, if use "export" under shell, that is forbidden to claim a variable name with dot inside.
That will show error message: "not a valid identifier"

But, I saw someone with "env" could claim variable name with dot.
https://unix.stackexchange.com/questions/93532/exporting-a-variable-with-dot-in-it
https://stackoverflow.com/questions/26506539/reference-to-a-bash-variable-whose-name-contains-dot

Normally containerTemplate "command" will be occupied with "cat", right?
I don't really understand the principle of containerTemplate with "cat".

If I plan to use Kubernetes args to carry some variable to Docker entry point file and replace the variable inside this entry point file.
And of course insert "cat" inside entry point. Is that possible let cat stay in docker entry point file?

Thanks very much.

Hong


Am Donnerstag, 10. August 2017 21:09:08 UTC+2 schrieb Carlos Sanchez:
You can not use dots in an environment variable

https://kubernetes.io/docs/api-reference/v1.6/#envvar-v1-core

a valid C identifier must start with alphabetic character or '_', followed by a string of alphanumeric characters or '_'


On Wed, Aug 9, 2017 at 9:18 AM, WANG, YAN-HONG <allway...@gmail.com> wrote:
Hello,

I am Hong.

I saw "containerEnvVar" was supported by Jenkins Kubernetes Plugin 0.9.
But, it seems not support some key value with dot?

Example in containerTemplate:
containerEnvVar( key: “data.source.url”, value: “somewhere” )

I tried to use backslash to escape dot, but Jenkins parser doesn't pass it.

Someone has idea?

Thanks very much.

Best regards,
Hong

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

YAN-HONG WANG

unread,
Aug 14, 2017, 6:51:54 AM8/14/17
to Jenkins Users
Hello Carlos,

I found out some other way to avoid to use dot in variable name.
Thanks.

Hong
Reply all
Reply to author
Forward
0 new messages