Closed MLukman closed 4 years ago
Hi @MLukman, I have a branch which would add support for environment variable interpolation in the other parameters of the plugin. If you have time and feel adventurous, try out the plugin compiled from the branch. I haven't tested it on a real instance yet but if my tests are not too wrong it should work ™.
I want to give more thoughts about the rollout before going any further. This is potentially a breaking change and I'd like to verify how/if people could have used variable in those fields without interpolation.
Hi @maxlaverse, I tried the plugin compiled from the branch and it works. Thanks!
Regarding the use of $variable in those fields, I think it is safe to assume that if the '$' symbol is used, it is always meant to denote a variable because it is an invalid character for DNS Label Names, and by inference is invalid for API endpoints, clusters and namespaces. The symbol, however, can be used for a context name, but since the context name field is used to create a temporary context for the job build, you can put disclaimer to the users to only put '$' symbol if they want it to be interpolated as variables.
Released in 1.9.0.
Expected Behavior
The plugin should be able to consume $VAR for all configuration keys
Actual Behavior
The plugin works when only "Kubernetes API endpoint", "Cluster name" and "Context name" use $VAR but failed when "Namespace" also uses $VAR
Steps to Reproduce the Problem
In addition to this plugin, also install plugins:
Create a folder.
Configure the following folder properties KUBE_API, KUBE_CLUSTER, KUBE_CONTEXT, KUBE_NS:
Create a job inside that folder that use the following kubectl configuration. Also ensure "Folder properties" is ticked:
Add a shell build step using simple kubectl command like
kubectl get all
.Job build will error.
Change "Namespace" to use hard-coded value.
Job build will succeed.
Specifications