Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab-ci - Pipeline Fails to run

I get the following error when i try to run the pipeline

sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper

Has this got something to do with gitlab-runner permissions? I have tried giving it full access, but still it fails. Can someone help me out?

I am following the guide mentioned on gitlab at https://docs.gitlab.com/runner/install/linux-manually.html

Gitlab Runner Version: 13.4.1 Git revision: e95f89a0 Git branch: 13-4-stable GO version: go1.13.8 Built: 2020-09-25T20:03:43+0000 OS/Arch: linux/amd64

Ubuntu Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

like image 852
Joshua Michael Savio Fernandes Avatar asked Sep 06 '25 00:09

Joshua Michael Savio Fernandes


2 Answers

I seemed to have found a workaround.

as answered by @maksim.danilin on https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2126

  • Remove all files from .* files from /home/gitlab-runner
  • rm * should do the trick if you are inside gitlab-runner folder

Futhermore follow the solution by @Reactgular (How to use sudo in build script for gitlab ci?)

  • Grant sudo permissions to the gitlab-runner user
    • $ sudo usermod -a -G sudo gitlab-runner
  • Remove the password restriction for sudo for the gitlab-runner user
    • $ sudo visudo
  • Add the following to the bottom of the file
    • gitlab-runner ALL=(ALL) NOPASSWD: ALL
like image 77
Joshua Michael Savio Fernandes Avatar answered Sep 07 '25 13:09

Joshua Michael Savio Fernandes


Just an additional information if the error is showing as "command not found " . Ensure you have /usr/local/bin/ in $PATH for root or you might get a command not found error. Alternately, you can install gitlab-runner in a different location, like /usr/bin/.

just check

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

I have documented gitlab runner setup. Feel free to refer! https://github.com/edureka2021/gitlab.git

like image 38
Nandhana Pramod Avatar answered Sep 07 '25 15:09

Nandhana Pramod