xeon123
xeon123

Reputation: 909

Gitlab pipeline running in VM and not in Gitlab server

I have a Gitlab server from the company where the project and the pipeline are configured. By default, every time a commit is done, the pipeline starts to execute in the Gitlab server.

I have my personalized VM, which is completely different from Gitlab. I want that the pipeline will be executed in my personalized VM instead of the Gitlab server. What should I do so that the pipeline runs on the VM and not on the Gitlab server?

I have configured the following runner in config.toml that is located in $MYPROJECT/:

[[runners]]
  name = "Project-name"
  url = "https://gitlab.server/"
  token = "TOKEN ID"
  executor = "shell"
  shell = "bash"

There are things that I don't understand.

  1. If I want to execute the pipeline in my personalized VM, should I install Gitlab runner in the VM [1]?
  2. Should I have the project source code in the VM so that it can read the config.toml file every time there is a commit?
  3. If I register the runner with the token key in the Gitlab server, how the Gitlab server knows that the pipeline is to be executed in the VM and not in the server [2]?
  4. Should I use the executor docker or shell, to execute the pipeline in the VM?

[1] https://docs.gitlab.com/runner/install/linux-manually.html

[2] https://docs.gitlab.com/runner/register/#registering-runners

Upvotes: 0

Views: 660

Answers (1)

Thomas Löffler
Thomas Löffler

Reputation: 6164

  1. For running a job on a machine you need a GitLab Runner installed on that machine, connected with the GitLab server.
  2. The project source code is fetched automatically in front of every run
  3. You can use a tag (e.g. "MyVM") when registering the runner. Then you can set the same tag into your job so that this job is only executed by this runner. See: https://docs.gitlab.com/ee/ci/runners/configure_runners.html#use-tags-to-control-which-jobs-a-runner-can-run
  4. You need to use docker if you want to use docker in your VM (which needs to be installed before there). Otherwise use shell.

Upvotes: 1

Related Questions