[JIRA] (JENKINS-61623) Using post section in kuberenetes agents (kuberenetes-plugin)

2 views
Skip to first unread message

sami.sallmen@gmail.com (JIRA)

unread,
Apr 7, 2020, 11:23:02 AM4/7/20
to jenkinsc...@googlegroups.com
Sami Sallmen commented on Bug JENKINS-61623
 
Re: Using post section in kuberenetes agents (kuberenetes-plugin)

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:

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 inside the pipeline
  post {
    always {
      sh "echo this is a post step"
    }
  }
}


 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages