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.
Asked: 2023-02-21 11:00:00 +0000
Seen: 13 times
Last updated: Jan 06 '22