[Kubernetes Plugin Config.] Define pod labels with environment variables from UI

I’m an intern and I am configuring my Kubernetes plugin for Jenkins by following steps described here: Kubernetes

My DevOps team wanted to define a Pod Template and set labels dynamically to the Kubernetes pods allocated for a job, by using the user interface only: github.com/jenkinsci/kubernetes-plugin/blob/1b149dc3201d6a156cde82950cf3ca4cb92fce87/images/pod-template-configuration.png

Labels section can be ony filled with static string. Is there a way to use defined Jenkins environment variables instead ? Calling global variables in the Cloud Configuration form (Pod Template section precisely) may be a relevant feature for us.

Honestly, I did a lot of researches but did not find any similar request or answer on the same topic.
Do you think that such a feature is possible to implement ?


what does dynamically mean to you in this case? I’m pretty sure the plugin supports some token replacement.

There is a sample of the environment variables that we have defined in Jenkins:

Basically, we would like to set a pod label value (from the UI) with one env. variable related to the job.

For exemple, I tried different syntaxes (env.JOB_NAME, $JOB_NAME, ${JOB_NAME},“${JOB_NAME}”, JOB_NAME, …) but weren’t interpreted during a build execution.

Therefore, I don’t think this possible, at least I don’t have a clue how to proceed.

Since it’s been a few weeks I opened the topic, I’m just re-posting to know if such a feature is already implemented (see my last post)