是否可以在声明性詹金斯管道中使用dir?

时间:2020-06-07 14:02:14

标签: jenkins jenkins-pipeline allure

我做了这样的管道。它在舞台上毁了(“准备一组”)。

错误消息:java.lang.NoSuchMethodError:在步骤之间找不到这样的DSL方法“步骤”

是否可以在声明性詹金斯管道中使用dir?还是我犯了其他错误?

    pipeline {

options {
    buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30'))
}
agent {
    docker {
        image 'maven:3.5.4-jdk-8-alpine'
        args '-v /var/lib/jenkins:/usr/src/mymaven -w /usr/src/mymaven'
    }
}

parameters {
    string(name: "ExecutionTaskOne", defaultValue: "EEP-565;EEP-547;", description: "Test-set")
    choice(name: "ForksOne", choices: "10\n1\n5\n10", description: "Forks")
}

stages {
    stage('compile') {
        steps {
            sh 'mvn clean compile'
        }
    }

    stage('Prepare group one') {
        steps {
            dir('groupOne') {
                steps {
                    sh 'rm -rf src/test/resources/features'
                    sh 'mkdir src/test/resources/features'
                    script {
                        def features = "${ExecutionTaskOne}".split(";")
                            echo "${features}"
                            download_all(features)
                    }
                }
            }
        }
    }
    stage('Run group one') {
        steps {
            dir('groupOne') {
                withAllureUpload(serverId: 'default', projectId: '4', results: [[path: 'target/allure-results']]) {
                    sh 'mvn test -Dbrowser=chrome -Dremote=true -Dfork.count=${ForksOne} -Drp.enable=true'
                }
            }
        }
    }
}

    }

0 个答案:

没有答案