How to set the property of "Time in minutes to retain slave when idle" in podTemplate

489 views
Skip to first unread message

李立

unread,
May 11, 2017, 9:32:01 PM5/11/17
to Jenkins Developers
I see the the property of "Time in minutes to retain slave when idle" in jenkins configure when I use Kubernetes plugin. But I want to configure this property in podTemplate, just as
podTemplate(label: 'mypod', containers: [
    containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine', ttyEnabled: true, command: 'cat'),
    containerTemplate(name: 'golang', image: 'golang:1.6.3', ttyEnabled: true, command: 'cat')
  ]) {

    node('mypod') {
        stage('Get a Maven project') {
            git 'https://github.com/jenkinsci/kubernetes-plugin.git'
            container('maven') {
                stage('Build a Maven project') {
                    sh 'mvn clean install'
                }
            }
        }

        stage('Get a Golang project') {
            git url: 'https://github.com/hashicorp/terraform.git'
            container('golang') {
                stage('Build a Go project') {
                    sh """
                    mkdir -p /go/src/github.com/hashicorp
                    ln -s `pwd` /go/src/github.com/hashicorp/terraform
                    cd /go/src/github.com/hashicorp/terraform && make core-dev
                    """
                }
            }
        }

    }
}
 
How to set the Time in minutes to retain slave when idle in mypod ?

Carlos Sanchez

unread,
May 12, 2017, 3:02:38 AM5/12/17
to Jenkins Developers
it doesn't make sense to retain a slave declared in pipeline, as it is supposed to run only for the operations inside its brackets

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/f64a56a6-9e79-468c-82e9-762f40693c86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages