我尝试在Jenkins kubernetes插件中使用post步骤。有谁有主意吗?
java.lang.NoSuchMethodError: No such DSL method 'post' found among steps
我的管道:
podTemplate(
label: 'jenkins-pipeline',
cloud: 'minikube',
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'),
]) {
node('jenkins-pipeline') {
stage('test') {
container('maven') {
println 'do some testing stuff'
}
}
post {
always {
println "test"
}
}
}
}
发布于 2018-01-23 05:35:33
在撰写本文时,Post
is only supported in declarative pipelines。
如果你一定要使用post
,你可以看看他们的declarative example。
pipeline {
agent {
kubernetes {
//cloud 'kubernetes'
label 'mypod'
containerTemplate {
name 'maven'
image 'maven:3.3.9-jdk-8-alpine'
ttyEnabled true
command 'cat'
}
}
}
stages {
stage('Run maven') {
steps {
container('maven') {
sh 'mvn -version'
}
}
}
}
}
https://stackoverflow.com/questions/48387605
复制相似问题