【发布时间】:2019-01-04 09:16:08
【问题描述】:
詹金斯 2.107.3
我有一个管道 jenkins 作业来使用 npm run 执行下面的脚本
脚本
{
"name": "jenkins-postman-automation",
"version": "1.0.0",
"description": "test project",
"directories": {
"test": "01-TNR-CLIMPLUS-NEWMAN"
},
"scripts": {
"api-tests": "newman run 01-TNR-NEWMAN/01-TNR-CORE.postman_collection.json -e 99-Environnements/${Environnement} "
},
"author": "Reda",
"dependencies": {
"newman": "^3.5.2"
}
}
管道:
node(){
stage("testing"){
deleteDir()
echo 'git clone'
git branch: 'master', url: 'git@git.ci/postman.git'
sh "npm install"
try {
sh "npm run api-tests"
} catch (Exception err) {
currentBuild.result = 'UNSTABLE'
}
}
}
两种情况:
-
案例成功:当我将
${Environnement}声明为工作参数时 -
案例失败:当我在工作
def Environnement = "DEV"中声明${Environnement}时出现以下错误:
unable to read data from file "-e" ENOENT: no such file or directory, open '-e'
- 我的问题:我想在我的工作中使用一个变量,所以我该怎么做,请帮忙!
它只在我使用声明式管道时有效,但现在不行。
【问题讨论】:
标签: node.js jenkins npm jenkins-pipeline npm-scripts