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:
environment {
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/bin/sudo"
}
This will add the sudo command to the PATH environment variable and make it available in the environment where the Jenkins pipeline is running.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-02-21 11:00:00 +0000
Seen: 13 times
Last updated: Jan 06 '22
How can a parameter file be uploaded to GitHub using a Jenkins Job?
How can Azure DevOps Pull Request and Jenkins be utilized within a corporate network?
On the Jenkins server, the tcpSlaveAgentListener cannot be located.
What can be done when Jenkins fails to establish a connection with Git repository?
What is the procedure for referencing a particular branch in a shared Jenkins library?
How can I transfer folders from s3 to a jenkins pipeline?
What is the process to activate SAML SSO on Jenkins?
How can I prevent Jenkins from initiating a pull request build for a particular branch?