Дженкинс Версия: 2.107.1
Проблема: хотя файл присутствует, Дженкинс не может получить к нему доступ или перейти в репозиторий.
ПРИМЕЧАНИЕ: заменяется в реальном коде фактическим репозиторием GitHub
Код трубопровода:
`
node {
stage('Checkout SCM') {
checkout([$class: 'GitSCM', branches: [[name: '*/*********']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '******', url: 'https://github.com/******']]])
}
stage('Copy the file from the Jenkins-script in the workspace and run it') {
sh 'pwd'
sh 'ls -lrt $WORKSPACE'
sh 'ls -lrt $WORKSPACE/<repo>/jenkins_scripts/'
sh 'bash $WORKSPACE/<repo>/jenkins_scripts/test-snapshot.sh'
}
}
`
Консольный вывод:
`
[Pipeline] sh
[snap] Running shell script
+ ls -lrt /root/workspace/snap/<repo>/jenkins_scripts/
ls: cannot access '/root/workspace/snap/<repo>/jenkins_scripts/': No such file or directory
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 2
Finished: FAILURE
`