Artavo
Artavo

Reputation: 313

A script in gitlab ci that runs before each job?

Say, I want to set some environment variables that are used in all jobs.

How do I do that in a sane way?

Upvotes: 7

Views: 7225

Answers (2)

Artavo
Artavo

Reputation: 313

It's possible to use before and after script. The nice thing about it is you can overload it for a job if needed https://docs.gitlab.com/ee/ci/yaml/#before_script-and-after_script

Upvotes: 1

Mureinik
Mureinik

Reputation: 311228

You could add a top-level variables section to your .gitlab-ci.yml file:

variables:
  MY_VAR: "some_value"

Upvotes: 2

Related Questions