Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where does job script run in gitlab ci?

Where does the Job script runs? Does it run on the same system as of Runner? How the runner runs the script, and where does build get saved? It would be great, if someone could explain the whole flow of Gitlab CI.

like image 997
manish Avatar asked Oct 31 '22 05:10

manish


1 Answers

Yes, your jobs' scripts run on the same system as the runner. But before I go deeper, we need to discuss terminology. My team has run into issues before because the term 'runner' is overloaded. Humans typically use 'runner' to mean two different things:

  • A server on which the gitlab-ci exe is located
  • A gitlab-ci runner

The former should be self-explanatory; when you want to create a gitlab-ci runner, the first thing you do is provision a VM and put the exe on it somewhere.

The latter takes some explanation. gitlab-ci runners are not like Jenkins slaves; they're not entire servers. Instead, gitlab-ci runners act like a combination of workspaces and Jenkins labels. In other words, gitlab-ci runners combine a server, a gitlab instance, an execution environment and a set of tags. It is entirely possible, and in fact normal, to have multiple gitlab-ci runners on the same server.

The job script is completely decoupled from either type of runner (by 'job script' I assume you mean code called from a .gitlab-ci.yml file). Anything you call from that .gitlab-ci.yml, and in fact the script elements within it, will be executed

  • By a runner matching the tags configured for the job running the script
  • On the server on which that runner is installed
  • In a shell or Docker or Vagrant container, depending on the runner

Finally, the build is saved on the on which the runner is installed. the location will depend on the folder into which you dropped the gitlab-ci executable. Otherwise, jobs are stored on the file system in a manner reminiscent of Jenkins workspaces.

like image 119
Matt Alioto Avatar answered Nov 10 '22 19:11

Matt Alioto