简体   繁体   English

将 jenkins 文件中的 jenkins 参数传递给批处理脚本

[英]Pass a jenkins parameter from a jenkins file to a batch script

I have a jenkins pipeline script that reads choices in the following way我有一个 jenkins 管道脚本,它通过以下方式读取选择

parameters {参数 {

choice(name: 'RELEASE_CONFIG', choices: "Release\nRelease_FF", description: 'Builds the resim with the configuration selected')

} }

Now I need to pass the choice parameter to a batch script, I use the following code, but it doesn't work.现在我需要将选择参数传递给批处理脚本,我使用以下代码,但它不起作用。

stage('Build VS projects') {
                    steps {
                       
                        echo '${params.RELEASE_CONFIG}'
                        bat 'build_scripts/build_f360core_pc.bat ${params.RELEASE_CONFIG}'
                    }
                }

The echo statement just prints ${params.RELEASE_CONFIG} instead of printing the value. echo 语句只打印 ${params.RELEASE_CONFIG} 而不是打印值。

Please enclose value in double quote, single quote don't replace the value it will be treated as a string value.请用双引号将值括起来,单引号不要替换将被视为字符串值的值。

The below code should work for you.下面的代码应该适合你。

stage('Build VS projects') {
                    steps {
                       
                        echo "${params.RELEASE_CONFIG}"
                        bat "build_scripts/build_f360core_pc.bat ${params.RELEASE_CONFIG}"
                    }
                }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM