Dav*_*son 5 jenkins-groovy jenkins-pipeline
我的Jenkins CI/CD构建配置正常工作,直到我上一次拉取请求才发生变化,我需要重新开始工作.
该多枝管道被配置为运行jenkinsfile
从到位桶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)
Run Code Online (Sandbox Code Playgroud)
已安装脚本安全插件,并且进程内脚本批准未列出任何要批准的内容.
安装了Permissive Script Security Plugin并jenkins.xml
进行了修改,以包含-Dpermissive-script-security.enabled=true
运行该标志的标志.war
.
这些是基于如何禁用Jenkins管道构建的安全检查而实现和工作的
作为测试,我创建了一个Pipeline作业,允许启用和禁用Groovy Sandbox.这是使用我的管道脚本的以下减少版本配置的;
#!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')
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我启用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)
Run Code Online (Sandbox Code Playgroud)
如果我禁用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
Run Code Online (Sandbox Code Playgroud)
尝试将Script Security插件从v1.45降级到v1.44并重新启动Jenkins.
虽然我没有使用Permissive Script Security插件,但在更新插件后我自己也遇到了这个问题.
归档时间: |
|
查看次数: |
2512 次 |
最近记录: |