如何在特定的slave中限制jenkins管道docker代理? [英] How to restrict the jenkins pipeline docker agent in specific slave?
问题描述
我配置了多个jenkins从属服务器,并且只有带有dockerserver
的标签才具有docker env,然后如何在此从属服务器中限制jenkins管道docker代理?
I have several jenkins slaves configured and only label with dockerserver
has docker env, then how can I restrict the jenkins pipeline docker agent in this slave?
在Jenkinsfile
下不起作用,stage
内部的agent
将覆盖已定义的从属dockerserver
Below Jenkinsfile
doesn't work, the agent
inside stage
will overwrite the defined slave dockerserver
pipeline {
agent { label 'dockerserver' }
stages {
stage('Back-end') {
agent {
docker { image 'maven:3-alpine' }
}
steps {
sh 'mvn --version'
}
}
stage('Front-end') {
agent {
docker { image 'node:7-alpine' }
}
steps {
sh 'node --version'
}
}
}
}
它可能会选择其他不支持docker的奴隶
It may pick other slave which doesn't have docker supported
有什么建议吗?
推荐答案
After read the guideline more, noticed it was stated https://jenkins.io/doc/book/pipeline/docker/#specifying-a-docker-label.
应在jenkins全局(系统)配置中进行配置
It shall be configured in the jenkins global(system) configuration
这篇关于如何在特定的slave中限制jenkins管道docker代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!