-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
latest stable jenkins version
latest kubernetes-plugin version
Kubernetes-plugin claims to have integration with declarative pipeline.
however, picking up the example on the github repo:
pipeline { agent { kubernetes { yamlFile 'examples/declarative_from_yaml_file/KubernetesPod.yaml' } } stages { stage('Run maven') { steps { sh 'set' sh "echo OUTSIDE_CONTAINER_ENV_VAR = ${CONTAINER_ENV_VAR}" container('maven') { sh 'echo MAVEN_CONTAINER_ENV_VAR = ${CONTAINER_ENV_VAR}' sh 'mvn -version' } container('busybox') { sh 'echo BUSYBOX_CONTAINER_ENV_VAR = ${CONTAINER_ENV_VAR}' sh '/bin/busybox' } } } } } // simply adding a basic post step post{ always{ sh "echo this is a post step" }
adding the simple post section will not work with the error:
java.lang.NoSuchMethodError: No such DSL method 'post' found among steps
Analyzing the job logs I see that while it "supports" declarative syntax there is a node call on the run start.
So from what I believe declarative pipeline is not supported, what is supported is steps declarative syntax.
This should be clear in the docs, there is no real mention of this anywhere official
The post step in description is not really correct. It works if the post is on the same level as stages-section, a child to pipeline. Like this: