Ask Your Question
3

How can the error message "sudo command not found" be resolved when displayed in a Jenkins pipeline?

asked 2023-02-21 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-01-06 22:00:00 +0000

bukephalos gravatar image

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.

edit flag offensive delete link more

Your Answer

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

Add Answer


Question Tools

Stats

Asked: 2023-02-21 11:00:00 +0000

Seen: 13 times

Last updated: Jan 06 '22