- Add GitLab's official repository via apt-get or yum: Debian/Ubuntu: curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash RHEL/CentOS: curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash
- sudo apt-get update
- sudo apt-get install gitlab-ci-multi-runner
- sudo gitlab-ci-multi-runner register
- enter CI url from https://gitlab.com/xxx/project/runners
- enter token
- enter runner description
- enter executor (shell) That's it, runner is started automatically. Now you need to configure .gitlab-ci.yml
cache:
paths:
- node_modules/
# install FE npm dependencies and build app
fe_build:
stage: build
only:
- master
script:
- cd /opt/bitnami/apps/wott-new/htdocs/wottAPI/client
- sudo npm install
- sudo gulp build
# install BE npm dependencies
be_dependencies:
stage: build
only:
- master
script:
- cd /opt/bitnami/apps/wott-new/htdocs/wottAPI/server
- sudo npm install
# install EXPORTER npm dependencies
exporter_dependencies:
stage: build
only:
- master
script:
- cd /opt/bitnami/apps/wott-new/htdocs/wottAPI/exporter
- sudo npm install
# reload API
server_reload:
stage: reload
only:
- master
script:
- cd /opt/bitnami/apps/wott-new/htdocs/wottAPI
- sudo pm2 reload all
# stages (runs in series)
stages:
- build
- reload
Grant sudo permissions to the gitlab-runner user as this is who is executing the build script.
sudo usermod -a -G sudo gitlab-runner
You need to edit your sudoers file. On your machine type sudo visudo and add the following line:
username ALL = NOPASSWD: /bin/git
This will allow username to use git without any password.