-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-39867] Add environment variables to container from a secret. #162
[JENKINS-39867] Add environment variables to container from a secret. #162
Conversation
Thanks, I see a couple problems
|
Thanks @carlossg.
|
needs rebase :\ |
@carlossg Has been rebased now. |
@carlossg Any chance you could merge this now as I won't be able to work on this for much longer. Thanks. |
@@ -287,4 +267,19 @@ public static String substitute(String s, Map<String, String> properties, String | |||
} | |||
return s; | |||
} | |||
|
|||
private static List<AbstractContainerEnvVar> combineEnvVars(ContainerTemplate parent, ContainerTemplate template) { | |||
List<AbstractContainerEnvVar> combinedSimpleEnvVars = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the name here is misleading, right?
It seems that we are talking about all env vars not just simple, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, it is both types. I have renamed the variables accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me!
@carlossg: Do you mind bringing this in? As you initially requested changes, I'd like to hear you opinion before merging it. |
…regory/kubernetes-plugin into tkgregory-secret-environment-variables
I have a working branch with these changes and some more tests, will push in a bit |
Run all env var checks under one test Set the correct syntax for envvars in readme
Use envVar and secretEnvVar for both pods and containers
I have removed the duplication betwen container and pod envVars and added pipeline tests, leaving The only problem right now is that the test fails with
|
This is now ready to be merged |
Upgrading from 0.12 causes class org.csanchez.jenkins.plugins.kubernetes.PodEnvVar is missing its descriptor
Fix #162 error PodEnvVar is missing its descriptor
Can someone confirm status of this merge? I am seeing two issues when using master with this branch
|
@MattLud can you provide an XML config file that exhibits than problems after upgrade. |
You should be using master, not this branch, due to #197 |
I was using latest master when testing with 2.70 and 2.32.1(default pom.xml). I can get the config.xml on Monday. |
Looks like the existing variables are no longer deleted. https://gist.github.com/MattLud/cec8a3a7e63c89beb88f7c59fd8aef4e Version of code being used rev: 5d4bb7 (today's master) Steps to recreate:
|
Also noticed this in my logs WARNING: Father of PodEnvVar [getValue()=sample, getKey()=sample] and its getDescriptor() points to two different instances. Probably malplaced @extension. See http://hudson.361315.n4.nabble.com/Help-Hint-needed-Post-build-action-doesn-t-stay-activated-td2308833.html |
Previously, environment variables could only be configured as key/value pairs whose value was defined in Jenkins configuration.
This pull request adds the ability to configure an environment variable whose value is derived from a Kubernetes secret. The changes are summarised below:
simple
orsecret
environment variable, both for pod and container templates.buildEnvVar
method.