Jenkins Pipeline 轻量级执行器仍然是重量级
Jenkins Pipeline flyweight executor still heavyweight
如何确保一个阶段在轻量级 Jenkins 执行器中执行?
假设我有以下 Jenkinsfile
:
pipeline {
agent any
stages {
stage("Build") {
// build
}
stage("Review") {
agent none
steps {
input "Deploy to production?"
}
}
stage("Promotion") {
steps {
echo "Promotion"
}
}
}
}
在 Review
阶段我指定了 agent none
,据我了解,这意味着 Jenkins 将在这个阶段使用享元执行器。但是,executor 在这个阶段仍然是重量级的,用掉了 Jenkins slave 上一个有价值的 executor 之一。
Jenkins 上是否有可能禁用轻量级执行程序的设置?是否有启用轻量级执行程序的插件?我的 Jenkinsfile 有缺陷吗?
您必须在开始时使用 agent none
才能启用享元执行器。
pipeline {
agent none
stages {
stage("Build") {
agent any
steps {
// build
}
}
}
}
但是这样做会限制您在 environment
等设置块中可以做的事情,因为在舞台之外没有可用的真实机器。这可能意味着如果您没有开始使用 agent none
.
,则必须重写很多管道
如何确保一个阶段在轻量级 Jenkins 执行器中执行?
假设我有以下 Jenkinsfile
:
pipeline {
agent any
stages {
stage("Build") {
// build
}
stage("Review") {
agent none
steps {
input "Deploy to production?"
}
}
stage("Promotion") {
steps {
echo "Promotion"
}
}
}
}
在 Review
阶段我指定了 agent none
,据我了解,这意味着 Jenkins 将在这个阶段使用享元执行器。但是,executor 在这个阶段仍然是重量级的,用掉了 Jenkins slave 上一个有价值的 executor 之一。
Jenkins 上是否有可能禁用轻量级执行程序的设置?是否有启用轻量级执行程序的插件?我的 Jenkinsfile 有缺陷吗?
您必须在开始时使用 agent none
才能启用享元执行器。
pipeline {
agent none
stages {
stage("Build") {
agent any
steps {
// build
}
}
}
}
但是这样做会限制您在 environment
等设置块中可以做的事情,因为在舞台之外没有可用的真实机器。这可能意味着如果您没有开始使用 agent none
.