I am using the OpenShift Jenkins image within an OpenShift Cluster. This default Jenkins image results in a Jenkins container that is preconfigured to point to my Kubernetes cluster. Additionally, the container has two Kubernetes pod templates defined, one for maven and one for nodejs.
What I would now like to do is use a declarative pipeline and reference these pods. I tried the following
agent {
kubernetes {
//cloud 'kubernetes'
label 'maven'
}
}
But that gives an error stating
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 4: Missing required parameter for agent type "kubernetes": containerTemplate @ line 4, column 10.
kubernetes { ^
All of the (examples) that I can find for declarative pipelines show the pod templates being defined when the agent is specified.
Is it possible to reuse already defined templates in a declarative pipeline?
OpenShift
plugin (different from theKubernetes
plugin) - more information can be found at docs.openshift.org/3.9/dev_guide/openshift_pipeline.html – Marek Jelen