Search code examples
ubuntuamazon-ec2gitlabgitlab-cigitlab-ci-runner

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


Solution

  • 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