【发布时间】:2018-07-24 20:23:17
【问题描述】:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
echo "whoami".execute().text
script {
File f = new File('/home/jenkins/test2.txt');
f.createNewFile();
}
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
}
Jenkins 控制台日志:(出现异常:Started by user Edgar Yu Running 在耐久性级别:MAX_SURVIVABILITY [Pipeline] 节点上运行 Jenkins 在 /var/jenkins_home/workspace/test2 [管道] { [管道] stage [Pipeline] { (Build) [Pipeline] echo Building.. [Pipeline] echo 詹金斯
[管道] 脚本 [管道] { [管道] } [管道] // 脚本 [管道] } [管道] // 阶段 [管道] 阶段 [管道] { (测试) 由于早期故障而跳过阶段“测试”[管道] } [管道] // stage [Pipeline] stage [Pipeline] { (Deploy) Stage 'Deploy' 跳过 由于较早的故障 [Pipeline] } [Pipeline] // 阶段 [Pipeline] } [Pipeline] // 节点 [Pipeline] 管道结束 java.io.IOException: Permission denied at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1012)
【问题讨论】:
-
您的 jenkins 用户是否对 /home/jenkins 目录有写入权限?好像没有……
-
向给定目录/文件的应用程序运行用户授予权限,例如,chmod 777 fileName(这将授予所有用户和组的所有权限)
-
在这里阅读文档...computerhope.com/unix/uchmod.htm
-
你有什么问题?
-
你根本不知道情况。你不明白我在说什么。
标签: jenkins groovy jenkins-pipeline