I just configured jenkins and in the pre-build steps i am trying to restart jenkins but i end up with the following error
Commencing build of Revision c5b9f8daac
The "no tty present" error indicates that you have the 'requiretty' setting in your sudoers file. In your case, it is probably in /etc/sudoers.d. Once this line is there, it does not matter what group you are in - sudo will require a tty whenever it is executed.
To get around this, you need to either remove (or comment out) the requiretty line in the configuration file, or add a line to exclude your user from the requiretty setting. You can see how to do that here: Disable requiretty per user