我是 Jenkins 和 Docker 的新手。我有一个测试脚本,我想在 Jenkins 管道的某个阶段中执行,并且该测试脚本需要在具有 npm 和 k6 的环境中执行。因此,我为此创建了一个自定义 dockerfile:
pipeline {
agent { dockerfile true }
stages {
stage("Installations") {
steps {
echo "Installing node modules"
sh "npm clean-install"
}
}
stage("Test") {
steps {
echo "Running tests"
sh "k6 run script.js"
}
}
}
}
问题是,使用本文“使用 Dockerfile”部分(我在其中包含
agent { dockerfile true }
)中描述的方法会导致我的管道陷入“等待下一个执行器”。
注意:我不是 Jenkins 的管理员,所以我无法知道安装了哪些插件或查看“管理 Jenkins”设置中的任何内容。如果我使用
agent any
代替,管道不会卡在等待执行器(尽管我的脚本当然无法执行)。
C:\Users\shriy>mongoimport --uri mongodb+srv://rutupathare@123:[电子邮件受保护]/gofood --co llection food_items --type jsonArray --file "C:\Users\shriy\Downloads oodData2.json" “mongoimport”不被识别为内部或外部命令, 可运行的程序或批处理文件。