Hello,
I followed the steps below to install GitLab Runner:
$ curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
$ sudo apt install gitlab-runner
Then:
$ sudo usermod -aG docker gitlab-runner
$ sudo nano /etc/sudoers
gitlab-runner ALL=(ALL) NOPASSWD: ALL
Containers and source repositories are located in another partition. I did the following steps to grant permission to the gitlab-runner user:
# groupadd runner
# /sbin/usermod -a -G runner gitlab-runner
# /sbin/usermod -a -G runner root
# chgrp -R runner /mnt/partition/
# chmod -R g+rwx /mnt/partition/
# chown -R gitlab-runner /mnt/partition/
The result is:
# ls -l
total 20
drwxrwxr-x 5 gitlab-runner runner 4096 Apr 22 09:22 partition
drwxrwx--- 2 gitlab-runner runner 16384 Apr 9 16:50 lost+found
The content of the .gitlab-ci.yml file is as follows:
stages:
- build
- deploy
cache:
paths:
- node_modules/
build-test:
stage: build
script:
- rm -rf node_modules
- mkdir -p node_modules/
- rm -rf /mnt/partition/containers/test
- cd /mnt/partition/containers/
- git clone http://jason:PASS@192.168.1.2/project/test.git
tags:
- backend
- test
deploy-test:
stage: deploy
script:
- cd /mnt/partition/containers/YAML
- docker compose up -d test
tags:
- backend
- test
But I get the following error message:
Running with gitlab-runner 16.11.0 (91a27b2a)
on test t_Wy2xFrX, system ID: s_a88f5fe318c9
Preparing the "shell" executor
Using Shell (bash) executor...
Preparing environment
Running on project...
Getting source from Git repository
Fetching changes with git depth set to 20...
Initialized empty Git repository in /home/gitlab-runner/builds/t_Wy2xFrX/0/project/test/.git/
Created fresh repository.
remote: You are not allowed to download code from this project.
fatal: unable to access 'http://192.168.1.2/project/test.git/': The requested URL returned error: 403
ERROR: Job failed: exit status 1
The Git command does not give any error without using the runner:
# git clone http://jason:PASS@192.168.1.2/project/test.git
Cloning into 'test'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (91/91), done.
remote: Compressing objects: 100% (91/91), done.
remote: Total 124 (delta 54), reused 0 (delta 0), pack-reused 33
Receiving objects: 100% (124/124), 178.22 KiB | 7.13 MiB/s, done.
Resolving deltas: 100% (54/54), done.
Any idea?
Thank you.