在从站而不是主站上运行pipline [英] Run pipline on slave not master

查看:171
本文介绍了在从站而不是主站上运行pipline的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Jenkins pipline (在Jenkins v2.58上),并且正在尝试使构建在从属服务器而不是主服务器上运行.但是,无论我在Jenkins文件中尝试使用哪种魔术,Jenkins都会继续在master上运行.

I am running Jenkins pipline (on Jenkins v2.58) and am trying to get the build to run on a slave not the master. Yet, whatever magic I try in the Jenkinsfile, Jenkins keeps running on master.

如何指定从执行器?

这是我的玩具Jenkinsfile,如果有帮助的话:

Here is my toy Jenkinsfile, if that helps:

pipeline {
    agent {
        node {
            label='CentOS7'
        }
    }

    stages {
        stage('Creating tox virtual environment') {
            steps { 
                sh 'uname -a'
                sh 'tox -v --recreate' 
            }
        }
    }
}

推荐答案

正确的语法似乎是:

pipeline {
    agent { label 'CentOS7' }

    stages {
        stage('Creating tox virtual environment') {
            steps { 
                sh 'uname -a'
                sh 'tox -v --recreate' 
            }
        }
    }
}

另外,请确保您的主机正在运行.

Also, make sure your master is running.

这篇关于在从站而不是主站上运行pipline的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆