I installed Gitlab Runner and after installation I did the following steps:
Code: Select all
$ sudo usermod -aG docker gitlab-runner
$ sudo nano /etc/sudoers
gitlab-runner ALL=(ALL) NOPASSWD: ALL
Code: Select all
# ls -l
total 20
drwxrwxr-x 5 root root 4096 Apr 22 09:22 partition
drwxrwx--- 2 root root 16384 Apr 9 16:50 lost+found
Code: Select all
# chown -R gitlab-runner /mnt/partition
I did the following step:
Code: Select all
# chown -R root /mnt/partition
# 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/
The content of the .gitlab-ci.yml file is as follows:
Code: Select all
stages:
- build
- deploy
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
deploy-test:
stage: deploy
script:
- cd /mnt/partition/containers/YAML
- docker compose up -d test
Thank you.