我目前遇到的问题是,Jenkins试图从外部访问/替换sh
脚本中定义在容器内的环境变量:
stage('Run phpunit') {
agent {
docker { image 'php:7.2-alpine' }
}
steps {
sh """
apk add --no-cache ${PHPIZE_DEPS}
pecl install xdebug
docker-php-ext-enable xdebug
php vendor/bin/phpunit --colors=never --log-junit build/junit.xml --coverage-clover build/clover.xml
"""
}
}
Jenkins在这一步骤失败,显示以下信息:
groovy.lang.MissingPropertyException: No such property: PHPIZE_DEPS for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:242)
at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)