Gitlab-CI Runner: sudo: no tty present and no askpass program specified

The problem

When you execute a gitlan-ci job tht uses sudo you can get the following error:

$ sudo apt update
sudo: no tty present and no askpass program specified
ERROR: Job failed: exit status 1

The solution

open your /etc/sudoers with sudo and add the following line:

gitlab-runner ALL=(ALL) NOPASSWD: ALL