Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61624

Using post section in kuberenetes agents (kuberenetes-plugin)

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: kubernetes-plugin
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      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 

       

       

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              one_random_dev Random Dev
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: