I’m new to Jenkins and Docker. I have a test script that I want to execute in a stage in my Jenkins pipeline, and this test script needs to be executed in an environment with npm and k6. So, I have created a custom dockerfile for this:
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"
}
}
}
}
The problem is that using the method described in the “Using a Dockerfile” section in this article, where I include agent { dockerfile true }
, causes my pipeline to get stuck “waiting for next executor”.
Notes: I’m not an administrator on our Jenkins, so I can’t tell what plugins have been installed or view anything in “Manage Jenkins” settings. If I use agent any
instead, the pipeline doesn’t get stuck waiting for an executor (although of course my script can’t execute).