-
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
Improve the inheritFrom functionality to better cover containers and volumes. #84
Conversation
Apparently, this is dublicating existing code.... |
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.
Added some comments and needs rebase
@@ -85,6 +88,12 @@ | |||
private static final String DEFAULT_ID = "jenkins/slave-default"; | |||
private static final String WORKSPACE_VOLUME_NAME = "workspace-volume"; | |||
|
|||
private static final String JNLP_NAME = "jnlp"; | |||
private static final String DEFAULT_JNLP_ARGUMETS = "${computer.jnlpmac} ${computer.name}"; |
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.
typo ARGUMETS
@@ -13,6 +13,10 @@ | |||
<f:textbox/> | |||
</f:entry> | |||
|
|||
<f:entry field="inheritFrom" title="The name of the pod template to inherit from"> |
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 this needs some help text in help-inheritFrom.html, and some docs in the README
@carlossg: I will apply your comments, rebase and squash. Since, I added this pull request I've been playing a lot with this feature and I am starting to think that it would make sense to be able to inheritFrom multiple parents. So that I can easily compose a pod out of prexisting templates (I think of it as maven profiles). So one could define in the config.xml a template for 'maven', 'golang' etc and then just use that. So the example we have at the readme could then look like:
Would you like to add that feature too? |
wouldn't that be more like
or something like that? |
The problem with using something like: Of course, this is something we could change if we wanted, but by inheriting podTemplates also allows us to inherit volumes and I can see that being useful too. |
right, so we'd need a description somewhere about what gets inherited from podTemplate |
Fixed typo, added docs, rebased, squashed and added support for multiple parent pod template via |
…o correctly handle duplicate volumes.
This pull request allows a PodTemplate to define a parent template that will be used as a base.
This allows the user to remove repeating/boilerplate code from pipeline and move it in the plugin configuration.
The main benefits are reusability (e.g. don't add the jnlp container everywhere), readability, and more importantly decoupling the pipelines from specific configurations, that might change between environments.
For example: There are environments that may or may not allow the use of hostPath mounts, privileged containers etc. So instead of maintaining two different sets of
Jenkinsfile
inside a project one could just move thoseenvironment sensitive details
in the parent pod, that could even be defined inside the jenkins docker image.