我正在运行一个Jenkins管道,其中我有一个要运行的flask应用程序,然后进行测试(使用鼻部)
我当前使用的Jenkinsfile是
pipeline {
agent { docker { image 'python:3.8.0' } }
stages {
stage('build') {
steps {
withEnv(["HOME=${env.WORKSPACE}"]) {
sh 'python --version'
sh 'python -m pip install --upgrade pip'
sh 'pip install --user -r requirements.txt'
sh script:'''
#!/bin/bash
echo "This is start $(pwd)"
cd ./flask/section5
echo "This is $(pwd)"
python create_table.py
python myapp.py &
nose2
'''
}
}
}
}
}Jenkins创建docker镜像并下载pythnon需求。从shell脚本运行nose2时出现错误
使用此错误
+ pwd
+ echo This is start .jenkins/workspace/myflaskapptest_master
This is start .jenkins/workspace/myflaskapptest_master
+ cd ./flask/section5
+ pwd
+ echo This is .jenkins/workspace/myflaskapptest_master/flask/section5
This is .jenkins/workspace/myflaskapptest_master/flask/section5
+ python create_table.py
DONE
+ nose2+
python myapp.py
.jenkins/workspace/myflaskapptest_master@tmp/durable-1518e85e/script.sh: 8: .jenkins/workspace/myflaskapptest_master@tmp/durable-1518e85e/script.sh: nose2: not found我遗漏了什么?
发布于 2019-12-23 04:11:13
我通过以这种方式更改Jenkinfile修复了它(即jenkins构建工作
sh script:'''
#!/bin/bash
echo "This is start $(pwd)"
cd ./flask/section5
echo "This is $(pwd)"
python create_table.py
python myapp.py &
cd ./tests
python test.py
'''我更喜欢像在我的机器上一样运行nose2。如果有人知道如何解决这个问题,那就太好了
https://stackoverflow.com/questions/59446380
复制相似问题