35 lines
630 B
Groovy
35 lines
630 B
Groovy
@groovy.transform.Field
|
|
def POD_YAML = '''\
|
|
spec:
|
|
containers:
|
|
- name: jnlp
|
|
volumeMounts:
|
|
- name: kubectl
|
|
mountPath: /bin/kubectl
|
|
readOnly: true
|
|
volumes:
|
|
- name: kubectl
|
|
hostPath:
|
|
path: /usr/bin/kubectl
|
|
type: File
|
|
'''
|
|
|
|
def call(args) {
|
|
def namespace = args?.namespace
|
|
def name = args?.name
|
|
|
|
if (name == null) {
|
|
name = env.JOB_NAME.split('/')[1]
|
|
}
|
|
|
|
if (namespace == null) {
|
|
namespace = name
|
|
}
|
|
|
|
podTemplate(yaml: POD_YAML) {
|
|
node(POD_LABEL) {
|
|
sh "kubectl rollout restart deployment -n ${namespace} ${name}"
|
|
}
|
|
}
|
|
}
|