我的 Jenkins CI/CD 构建配置正在工作,直到我上次拉取请求为止没有任何变化,我需要让它再次工作。
The 多分支管道配置为运行jenkinsfile
来自 BitBucket SCM,但现在失败并出现以下错误;
groovy.lang.MissingPropertyException: No such property: pipeline for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:130)
脚本安全插件已安装,并且进程内脚本批准没有列出任何要批准的内容。
许可脚本安全插件已安装并且jenkins.xml
被修改为包括-Dpermissive-script-security.enabled=true
运行的标志.war
.
这些是之前基于以下内容实施和工作的如何禁用 Jenkins 管道构建的安全检查
作为测试,我创建了一个管道作业,允许启用和禁用 Groovy 沙箱。这是使用我的管道脚本的以下精简版本进行配置的;
#!groovy
pipeline {
agent any
environment {
VERSION = "${env.MAJOR_VERSION}.${env.MINOR_VERSION}"
BUILD_LABEL = "MyProject ${env.VERSION} Build #${env.BUILD_NUMBER}"
BUILD_SOURCESDIRECTORY = "${WORKSPACE}\\src"
}
options {
copyArtifactPermission('MyProject-Deploy')
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5'))
}
parameters {
string (
defaultValue: '3',
description: 'MyProject Major Version',
name : 'MAJOR_VERSION')
string (
defaultValue: '7',
description: 'MyProject Minor Version',
name : 'MINOR_VERSION')
}
stages {
stage('Checkout Source') {
steps {
echo('checkout scm')
}
}
}
}
如果我启用了Use Groovy Sandbox
并运行作业我得到同样的错误;
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property: pipeline for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:130)
如果我禁用Use Groovy Sandbox
管道脚本成功完成;
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in C:\Jenkins-Workspace\Pipeline-Test
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout Source)
[Pipeline] echo
checkout scm
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
- 如何确保 Jenkins 配置干净?
- 我应该尝试将 Jenkins 从 v2.121.3 降级吗?