我使用以下命令在 docker 容器中使用 Jenkins
docker pull jenkins/jenkins
docker run -p 8080:8080 --name=jenkins-master jenkins/jenkins
出现这个错误
存储库链接 - -https://github.com/jatin633/Calculator.git
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building the application....'
}
}
stage('Test') {
steps {
echo 'Testing the application....'
git branch: 'python', url: 'https://github.com/jatin633/Calculator.git'
sh 'python calc.py'
sh 'python calculator_unittest.py'
}
}
stage('Deploy') {
steps {
echo 'Deploy the application....'
}
}
}
}
答案 0 :(得分:0)
我认为 calc.py 文件不在 root 中,所以也许尝试更改:
stage('Test') {
steps {
echo 'Testing the application....'
git branch: 'python', url: 'https://github.com/jatin633/Calculator.git'
sh 'python calc.py'
sh 'python calculator_unittest.py'
}
}
进入:
stage('Checkout') {
steps {
echo 'Testing the application....'
git branch: 'python', url: 'https://github.com/jatin633/Calculator.git'
}
}
stage('Run Program') {
dir('sources') {
steps {
sh 'python calc.py'
sh 'python calculator_unittest.py'
}
}
}
如果有帮助,请告诉我。问候!