相关疑难解决方法(0)

如何为Django应用程序编写Groovy Jenkins文件来运行我的测试?

我最近开始使用Jenkins,我想使用Multibranch Pipelines,所以我可以在我的项目中测试各种功能分支.

该项目正在使用django 1.8.到目前为止,我的Jenkinsfile看起来像这样并且在测试阶段失败,因为django无法找到我的设置文件,即使它在那里:

node {
    // Mark the code checkout 'stage'....
    stage 'Checkout'

    // Get the code from a GitHub repository
    git credentialsId: 'mycredentials', url: 'https://github.com/<user>/<project>/'

    // Mark the code build 'stage'....
    stage 'Build'

    env.WORKSPACE = pwd()

    sh 'virtualenv --python=python34 venv'
    sh 'source venv/bin/activate'

    sh 'pip install -r requirements.txt'

    env.DJANGO_SETTINGS_MODULE = "<appname>.settings.jenkins"

    // Start the tests
    stage 'Test'
    sh 'python34 manage.py test --keepdb'
}
Run Code Online (Sandbox Code Playgroud)

django groovy jenkins

5
推荐指数
1
解决办法
1523
查看次数

标签 统计

django ×1

groovy ×1

jenkins ×1