‘Jenkins’ 在 v. 2.307+ 升级后缺少节点标签‘master’

‘Jenkins’ missing node label ‘master’ after v. 2.307+ upgrade

升级到 2.307 并应用术语更改(从 'master' 到 'Built-In Node')后,我的构建停止工作并出现以下错误消息: “Jenkins”没有标签“master”

我的 Jenkinsfile 如下所示:


node('master') {
    dir('build') {
        stage('Checkout') {
            ...
        }
    }
}

如果您只有一个节点或者不关心您的构建是在哪个节点运行,您可以只删除特定的节点名称:

node {
    dir('build') {
        stage('Checkout') {
            ...
        }
    }
}

否则,您可以转到仪表板 -> 管理 Jenkins -> 管理节点和云,然后在将鼠标悬停在节点名称上时按向下箭头并按配置。在这里你可以添加一个标签,然后你可以像上面那样在你的 Jenkinsfile 中使用它。

升级时对read the Changelog有帮助。 您也可以在 Jenkins 中查找节点。

  • Replace the term "master" with "controller" (for the main Jenkins application) or "built-in node", as appropriate. (pull 5425)
  • Add migration code to only change the node name (e.g. NODE_NAME environment variable) and label of the built-in node after explicit migration by an administrator. New installations get the new node and and label immediately. (pull 5425)
  • Add the system property jenkins.model.Jenkins.nodeNameAndSelfLabelOverride to specify a different node name and label for the built-in node (e.g. for Configuration as Code use cases) than the one otherwise determined. This will not affect other uses of the node name, such as the URL to the built-in node (now /computer/(built-in)/). (pull 5425)

澄清:

如果您的作业定义、管道定义或工具安装程序引用必须绑定到内置节点,则应使用标签“built-in”而不是“master”。使用内置(以前的主)节点是strongly discouraged

新节点url(如下图)是:${JENKINS_URL}/computer/(built-in)/而不是${JENKINS_URL}/computer/(master)/


选择: 可以通过将“master”作为标签添加到“built-in”节点来继续现有配置。