Jenkins管道脚本未运行。我能知道这个Jenkins管道脚本的原因吗?
pipeline {
agent any
stages{
stage('Git checkout'){
steps{
script{
git branch: 'development', credentialsId: '...elided...'
}
}
}
stage('gradle build'){
steps{
script{
sh """
cd cws/ReportRepo/th.cws/thub/mod.cwscommon
./gradle clean build
./gradle publishToMavenLocal
"""
}
}
}
stage('second file gradle build'){
steps{
script{
sh """
cd cws/ReportRepo/th.cws/thub/mod.cwsaudit
./gradle clean build
./gradle publishToMavenLocal
"""
}
}
}
stage('third file gradle build'){
steps{
script{
sh """
cd cws/ReportRepo/th.cws/thub/mod.cwscore
./gradle clean build
./gradle publishToMavenLocal
"""
}
}
}
stage('fourth file gradle build'){
steps{
script{
sh """
cd cws/ReportRepo/th.cws
./gradle clean build
./gradle publishToMavenLocal
"""
}
}
}
stage('file gradle build'){
steps{
script{
sh """
cd cws-batch-api-ms
./gradle clean build
cd cws-batch-api-ms/build/l
docker buildx build --platform linux/amd64 -t cws-backend .
"""
}
}
}
}
}
这个错误我得到cd: directory permission denied
+ cd cws/ReportRepo/th.cws/thub/mod.cwscommon
/var/lib/jenkins/workspace/mcn@2@tmp/durable-b82db53a/script.sh: 2: cd: can't cd to cws/ReportRepo/th.cws/thub/mod.cwscommon
1条答案
按热度按时间v8wbuo2f1#
如果您在特定目录中运行命令,最好使用Jenkins中的
dir
命令,而不是使用sh
脚本中的cd
:由于您收到权限拒绝错误,可能您的Jenkins用户没有访问
cws
文件夹的必要权限?尝试以Jenkins用户身份手动登录并访问文件夹,看看是否可行。如果没有,您可以向用户给予读取权限。