How to authenticate gitlab instance level runner for gitlab pipeline

My instance level runner will not successfully run finish jobs because it fails to authenticate with the repo.
I created a gitlab instance level runner that seems to be working and is ready to pick up jobsgitlab-runner is listed
The runner was configured using the following docker-compose file and it is running on the same linux server as the gitlab instance:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> GNU nano 7.2 docker-compose.yml version: '3.8'
services:
gitlab-runner:
image: gitlab/gitlab-runner:latest
container_name: gitlab-instance-runner
restart: always
privileged: true
env_file:
- .env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/etc/gitlab-runner
entrypoint: |
sh -c '
echo "Starting registration process..."
if [ ! -f /etc/gitlab-runner/config.toml ]; then
echo "Config file not found, registering runner..."
gitlab-runner register --non-interactive
--url "https://gitlab.my-server-adress.com/"
--executor "docker"
--docker-image "docker:latest"
--token "$RUNNER_AUTHENTICATION_TOKEN"
&& echo "Runner registered successfully."
|| echo "Runner registration failed."
else
echo "Config file found, skipping registration."
fi
echo "Starting runner..."
gitlab-runner run --user=gitlab-runner --working-directory=/home/gitlab-runner
'
volumes:
gitlab-runner-config:
</code>
<code> GNU nano 7.2 docker-compose.yml version: '3.8' services: gitlab-runner: image: gitlab/gitlab-runner:latest container_name: gitlab-instance-runner restart: always privileged: true env_file: - .env volumes: - /var/run/docker.sock:/var/run/docker.sock - ./config:/etc/gitlab-runner entrypoint: | sh -c ' echo "Starting registration process..." if [ ! -f /etc/gitlab-runner/config.toml ]; then echo "Config file not found, registering runner..." gitlab-runner register --non-interactive --url "https://gitlab.my-server-adress.com/" --executor "docker" --docker-image "docker:latest" --token "$RUNNER_AUTHENTICATION_TOKEN" && echo "Runner registered successfully." || echo "Runner registration failed." else echo "Config file found, skipping registration." fi echo "Starting runner..." gitlab-runner run --user=gitlab-runner --working-directory=/home/gitlab-runner ' volumes: gitlab-runner-config: </code>
  GNU nano 7.2                                               docker-compose.yml                                                         version: '3.8'

services:
  gitlab-runner:
    image: gitlab/gitlab-runner:latest
    container_name: gitlab-instance-runner
    restart: always
    privileged: true
    env_file:
      - .env
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config:/etc/gitlab-runner
    entrypoint: |
      sh -c '
      echo "Starting registration process..."
      if [ ! -f /etc/gitlab-runner/config.toml ]; then
        echo "Config file not found, registering runner..."
        gitlab-runner register --non-interactive 
          --url "https://gitlab.my-server-adress.com/" 
          --executor "docker" 
          --docker-image "docker:latest" 
          --token "$RUNNER_AUTHENTICATION_TOKEN" 
        && echo "Runner registered successfully." 
        || echo "Runner registration failed."
      else
        echo "Config file found, skipping registration."
      fi
      echo "Starting runner..."
      gitlab-runner run --user=gitlab-runner --working-directory=/home/gitlab-runner
      '

volumes:
  gitlab-runner-config:

this is the config.toml file that was generated:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "c1d4f2c35cd0"
url = "https://gitlab.my-server-adress.com/"
id = 11
token = "glrt-xxxxxxxxxxxxxxxxxxxx"
token_obtained_at = 2024-07-16T12:55:55Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.docker]
tls_verify = false
image = "docker:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
network_mtu = 0
</code>
<code>concurrent = 1 check_interval = 0 shutdown_timeout = 0 [session_server] session_timeout = 1800 [[runners]] name = "c1d4f2c35cd0" url = "https://gitlab.my-server-adress.com/" id = 11 token = "glrt-xxxxxxxxxxxxxxxxxxxx" token_obtained_at = 2024-07-16T12:55:55Z token_expires_at = 0001-01-01T00:00:00Z executor = "docker" [runners.cache] MaxUploadedArchiveSize = 0 [runners.docker] tls_verify = false image = "docker:latest" privileged = false disable_entrypoint_overwrite = false oom_kill_disable = false disable_cache = false volumes = ["/cache"] shm_size = 0 network_mtu = 0 </code>
concurrent = 1
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "c1d4f2c35cd0"
  url = "https://gitlab.my-server-adress.com/"
  id = 11
  token = "glrt-xxxxxxxxxxxxxxxxxxxx"
  token_obtained_at = 2024-07-16T12:55:55Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  [runners.cache]
    MaxUploadedArchiveSize = 0
  [runners.docker]
    tls_verify = false
    image = "docker:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
    network_mtu = 0

I have this .gitlab-ci.yml file that defines the pipeline:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>stages:
- build
docker-build:
image: docker:latest
stage: build
services:
- name: docker:dind
command: ["--tls=false", "--host=tcp://0.0.0.0:2375"]
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
script:
- docker build --pull -t "$DOCKER_IMAGE_NAME" .
- docker push "$DOCKER_IMAGE_NAME"
</code>
<code>stages: - build docker-build: image: docker:latest stage: build services: - name: docker:dind command: ["--tls=false", "--host=tcp://0.0.0.0:2375"] variables: DOCKER_HOST: tcp://docker:2375 DOCKER_TLS_CERTDIR: "" DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG before_script: - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - docker build --pull -t "$DOCKER_IMAGE_NAME" . - docker push "$DOCKER_IMAGE_NAME" </code>
stages:
  - build

docker-build:
  image: docker:latest
  stage: build
  services:
    - name: docker:dind
      command: ["--tls=false", "--host=tcp://0.0.0.0:2375"]
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""
    DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
  before_script:
    - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
  script:
    - docker build --pull -t "$DOCKER_IMAGE_NAME" .
    - docker push "$DOCKER_IMAGE_NAME"

now when I commit to the repo to trigger the pipeline the instance runner picks it up but it always fails at the stage “Fetching changes with git depth set to 20…”

this is the entire error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Getting source from Git repository
00:00
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/chipmunk/webapp/.git/
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://my-server-adress.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'http://gitlab.my-server-adress.com/chipmunk/webapp.git/'
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
</code>
<code>Getting source from Git repository 00:00 Fetching changes with git depth set to 20... Reinitialized existing Git repository in /builds/chipmunk/webapp/.git/ remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://my-server-adress.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied fatal: Authentication failed for 'http://gitlab.my-server-adress.com/chipmunk/webapp.git/' Cleaning up project directory and file based variables 00:01 ERROR: Job failed: exit code 1 </code>
Getting source from Git repository
00:00
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/chipmunk/webapp/.git/
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://my-server-adress.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'http://gitlab.my-server-adress.com/chipmunk/webapp.git/'
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

What could be the reason why the authentication fails?
I have another gitlab runner that is specific to a gitlab group and for some reason there the pipelines work perfectly.

I have also tried to set the privileged property in the config.toml file to true but I still ran into authentication issues although the error looked slightly different:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Getting source from Git repository
00:00
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/chipmunk/webapp/.git/
Created fresh repository.
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.my-server-adress.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'http://gitlab.my-server-adress.com/chipmunk/webapp.git/'
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
</code>
<code>Getting source from Git repository 00:00 Fetching changes with git depth set to 20... Initialized empty Git repository in /builds/chipmunk/webapp/.git/ Created fresh repository. remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.my-server-adress.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied fatal: Authentication failed for 'http://gitlab.my-server-adress.com/chipmunk/webapp.git/' Cleaning up project directory and file based variables 00:01 ERROR: Job failed: exit code 1 </code>
Getting source from Git repository
00:00
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/chipmunk/webapp/.git/
Created fresh repository.
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.my-server-adress.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'http://gitlab.my-server-adress.com/chipmunk/webapp.git/'
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật