While Jenkins building, it gives an error on console output like:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
How can i fix this situation?
There is this command in Execute Shell in configure:
sudo pnpm run build
Output:
16:42:03 > git config core.sparsecheckout # timeout=10
16:42:03 > git checkout -f 9998780d6a154bab01b4c010616f25a6f018d80c # timeout=10
16:42:03 Commit message: "fix swr"
16:42:03 > git rev-list --no-walk 9998780d6a154bab01b4c010616f25a6f018d80c # timeout=10
16:42:04 [ProjectReact] $ /bin/sh -xe /tmp/jenkins14253074063433648143.sh
16:42:04 sudo pnpm run build
16:42:04 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
16:42:04 Build step 'Execute shell' marked build as failure
16:42:04 Finished: FAILURE
CodePudding user response:
Remove sudo
from your script and let pnpm
run without it -- it doesn't require root permissions anyway.
sudo
is meant to be used in the terminal by a human user, and by default it requires the user's password to run commands with elevated privileges.
When running jobs on Jenkins you shouldn't be using sudo
.