首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jenkinsfile for Robotframework

Jenkinsfile for Robotframework
EN

Stack Overflow用户
提问于 2019-06-10 20:13:39
回答 1查看 1.1K关注 0票数 1

我在通过Jenkinsfile运行作业时遇到了一些问题。现在,作业运行到构建阶段,之后,它在每个阶段都会失败。我已经附加了一张图像,用于接收控制台输出。

找遍了所有地方,但没有得到任何解决方案,不知道我在代码中哪里出错了。

代码语言:javascript
复制
        parameters {
            booleanParam(defaultValue: true, description: 'Execute Pipeline?', name: 'GO')
        }
        agent {label 'test'}
        stages {
            stage('Preconditions'){
                steps {
                    script {
                        result = sh (script: "git log -1 | grep ' _*\\[ci skip\\].*'", returnStatus: true)
                        if (result == 0) {
                            echo "This build should be skipped. Aborting"
                            GO = "false"
                        }
                    }
                }
            }
            stage('Build'){
                steps {
                    script {
                        sh "pip install -r requirements.txt"
                        sh "mkdir -p ${out}/results"
                    }
                }
            }
            stage('Smoke') {
                steps {
                    script {
                        sh "robot -d results -i Smoke -v BROWSER:chrome test_suites"
                        currentBuild.result = 'SUCCESS'
                    }
                }
            }
            stage('Sanity') {
                steps {
                    script {
                    sh "robot -d results -i Sanity -v BROWSER:chrome test_suites"
                    currentBuild.result = 'SUCCESS'
                    }
                }
            }
            stage('Process Results') {
                steps {
                    script {
                        bat 'del "Results\\*.zip"'
                        zip zipFile: 'results/results.zip', archive: false, dir: 'results', glob: '*.html'
                        step([
                            $class : 'RobotPublisher',
                            outputPath : 'results',
                            outputFileName : "output.xml",
                            reportFileName : 'report.html',
                            logFileName : 'log.html',
                            disableArchiveOutput : false,
                            passThreshold : 95.0,
                            unstableThreshold: 95.0,
                            otherFiles : "**/*.png",
                            ])
                        }
                    }
                }
            }
        post {
            always {
                googlechatnotification url: 
            }
        }
    }````

The requirements.txt files contain all the bindings like: 
selenium==3.141.0
virtualenv==16.5.0
robotframework==3.1.1
robotframework-pabot==0.53
robotframework-seleniumlibrary==3.3.1
robotframework-react==1.0.0a2

[![Console Output][2]][2]


  [1]: https://i.stack.imgur.com/FPPPz.png
EN

回答 1

Stack Overflow用户

发布于 2019-06-11 20:38:32

我认为失败的命令是在Build阶段创建results目录,因为变量${out}使用的是Groovy语法而不是shell:

代码语言:javascript
复制
stage('Build'){
            steps {
                script {
                    sh "pip install -r requirements.txt"
                    sh "mkdir -p ${out}/results"
                }
            }
        }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56526200

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档