https://github.com/nvtkaszpir/vagrant-gitlab-runners
Different vagrant files with distros with installed gitlab-runner - for quick dev setups
https://github.com/nvtkaszpir/vagrant-gitlab-runners
centos docker gitlab gitlab-ci gitlab-runner libvirt lxc lxd vagrant
Last synced: about 1 year ago
JSON representation
Different vagrant files with distros with installed gitlab-runner - for quick dev setups
- Host: GitHub
- URL: https://github.com/nvtkaszpir/vagrant-gitlab-runners
- Owner: nvtkaszpir
- Created: 2018-03-15T21:41:54.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-17T20:41:08.000Z (over 6 years ago)
- Last Synced: 2025-03-24T05:51:45.238Z (about 1 year ago)
- Topics: centos, docker, gitlab, gitlab-ci, gitlab-runner, libvirt, lxc, lxd, vagrant
- Language: Ruby
- Size: 18.6 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gitlab-runner in vagrant
Example scripts to run different GitLab runners as virtual machines under
vagrant, as disposable, on-demand workers.
Shell scripts provided so that you really do not need anything else.
This can be easily converted into kickstart/preseed/cloudinit scripts.
## Notice
This is a quick proof of concept and is far from any production use.
There are already puppet/ansible modules/roles existing in the world.
## Providers
- virtualbox (not tested, but should work)
- libvirt
- LXC (Centos only), but it is deprecated, use vagrant-lxd
- LXD 3.x with [vagrant-lxd](https://gitlab.com/catalyst-it/vagrant-lxd)
## Flavours
- Centos 7.4 + gitlab-runner as docker executor (basic)
- Centos 7.4 + gitlab-runner as shell executor, with docker, java and gcc++
- Ubuntu 16.04 + gitlab-runner as docker executor (basic)
- Ubuntu 16.04 + gitlab-runner as shell executor, with docker, java and gcc++
Centos installs new kernel mainline from elrepo.
Ubuntu installs kernel HWE LTS.
OpenJDK 8, headless, but no ant/maven.
## Preparing
- ensure you have vagrant installed, verion 2.2.5
- ensure you have vagrant plugin installed for given provider
and it is properly configured, pro tip: read docs for given provider
really carefully!
- ensure you have vagrant plugin vagrant-reload
```bash
vagrant plugin install vagrant-reload
```
- (optional) ensure you have proper plugin installed for given providers,
for example vagrant-libvirt, vagrant-lxc, vagrant-lxd
- ensure you have configured system to be able to use given provider, refer to
documentation details provided by given plugin (especially for LXD)
- go to your GitLab install, find project
- go to Settings (on the bottom left), CI/CD, Runners settings, click expand
- there is a section 'Specific Runners', with URL and token in red, copy it.
## Adjusting setup
- go into specific directory
- copy ``.secrets.dist`` to ``.secrets``
- edit ``.secrets`` and update runner name, URL, project token to register and tags
- execute command in shell, to load env vars:
```bash
. .secrets
```
- after command above executed, start vagrant:
```bash
vagrant up --provider=
```
- in the end of vagrant execution you should see something in red color (yeah...):
```text
vm-name: Registering runner... succeeded runner=SOMETHING
vm-name: Runner registered successfully. Feel free to start it,
but if it's running already the config should be automatically reloaded!
```
- go to the GitLab project, and check if in Runner settings you see registered
runner.
- check your GitLab project and edit ``.gitlab-ci.yml`` to use proper tags in the
project depending on the build/step and so on.
## Rebuilding machine
Pretty obvious
```bash
vagrant destroy -f
vagrant up --provider=
```
Remember to go to GitLab CI and remove dead workers.