I have set up a freestyle project in Jenkins to run my NodeJS application and I'm using the shell script as below,
cd client
npm install --legacy-peer-deps
npm run build
cd ../server
npm install --legacy-peer-deps
export BUILD_ID=dontKillMePlease
pm2 start server.js --name=timetuner
sudo service nginx reload
Error we get ->
+ sudo service nginx reload
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Also we have updated the sudoers file as follows
Defaults:jenkins !requiretty,!lecture
jenkins ALL=NOPASSWD: /etc/init.d/nginx
Appreciate quick help! Thanks in advance.