Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The error message "sudo command not found" indicates that the sudo command is not available in the environment where the Jenkins pipeline is running. This error can be resolved by ensuring that the sudo command is available in the environment.

One approach is to add the sudo command to the PATH environment variable in the Jenkins pipeline. This can be done using the following steps:

  1. Add the following line to your Jenkinsfile at the beginning of the pipeline script:
environment {
  PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/bin/sudo"
}
  1. Save and run the pipeline again.

This will add the sudo command to the PATH environment variable and make it available in the environment where the Jenkins pipeline is running.