Jenkins 声明式管道,从 Git 的文件/groovy 脚本传递活动选择参数

时间:2021-04-28 08:55:58

标签: jenkins jenkins-pipeline jenkins-groovy

我有一个选择参数 TestingWith,我正在使用如下所示的声明性管道,它运行良好,但我想从 Git(使用文件/常规脚本)而不是在这里进行硬编码。

有人可以帮忙吗?

properties([parameters([[$class: 'ChoiceParameter', choiceType: 'PT_CHECKBOX', description: 'Select the configuration to be tested', filterLength: 1, filterable: false, name: 'TestingWith', randomName: 'choice-parameter-696139850799259', script: [$class: 'GroovyScript', fallbackScript: [classpath: [], sandbox: false, script: ''], script: [classpath: [], sandbox: false, script: 'return[\'R4.0\',\'R4.1\',\'R4.2\',\'R4.3\',\'R4.4\']']]]])])

pipeline {
    agent any
    environment
    {
        BUILD_TYPE = "test"
    }
    parameters
    {
        choice(name: "Testing",choices: ["false","true"],description: "Select the Tests to be executed or Not")
        string(name: "Version", defaultValue: "latest",description: "Specifiy the version of the application")
        booleanParam(name: 'ElementAccess', defaultValue: false, description: 'Only run tests from the ElementAccess Category.')

    }
    stages {
        stage ('Prepare Env') {
            steps {
                echo 'Preparing Environment'
            }
        }
        stage ('Building') {
            steps {
                echo 'Building the application'
            }
        }
    }
}

0 个答案:

没有答案
相关问题