Here's a snippet from my Jenkinsfile I use to create a dynamic pod
agent {
kubernetes {
label "hello-stage"
cloud "some-cloud"
defaultContainer "jnlp"
idleMinutes 1
containerTemplate {
name 'jnlp'
image 'some-image'
alwaysPullImage true
ttyEnabled true
resourceRequestMemory '1Gi'
resourceLimitMemory '2Gi'
}
imagePullSecrets '["secret-name"]'
} // kubernetes
} // agent
Everything works except for the imagePullSecrets
. I tried finding documentation with no luck. I'm new to using Jenkins with Kubernetes. Here's the error I get
WorkflowScript: 23: Invalid config option "imagePullSecrets" for agent type "kubernetes". Valid config options are [activeDeadlineSeconds, cloud, containerTemplate, containerTemplates, customWorkspace, defaultContainer, idleMinutes, inheritFrom, instanceCap, label, namespace, nodeSelector, podRetention, serviceAccount, slaveConnectTimeout, supplementalGroups, workingDir, yaml, yamlFile, yamlMergeStrategy] @ line 23, column 13.
imagePullSecrets '["quay-operator-updates"]'
Could someone please help me figure out how to use imagePullSecrets with Jenkins declarative pipeline?
Thanks
containerTemplate
is now deprecated as mentioned hereUse the yaml syntax to pass the
imagePullSecrets
as follows :