diff --git a/rails/gitlab-ci.yml b/rails/gitlab-ci.yml
index 75b0ca18fed5a10a51acabd187904f45af845e17..377e35489a7e88488a37fd44eca697c258bb0424 100644
--- a/rails/gitlab-ci.yml
+++ b/rails/gitlab-ci.yml
@@ -1,8 +1,9 @@
+variables:
+  CI: "true"
+  RAILS_ENV: test
+
 set_ruby_version:
   stage: build
-  variables:
-    CI: "true"
-    RAILS_ENV: test
   script:
     - echo "RUBY_VERSION=$(cat .ruby-version | sed 's/ruby-//g')" >> build.env
   artifacts:
@@ -12,9 +13,6 @@ set_ruby_version:
 rubocop:
   stage: test
   image: ruby:$RUBY_VERSION
-  variables:
-    CI: "true"
-    RAILS_ENV: test
   tags:
     - rails
   script:
@@ -25,9 +23,6 @@ rubocop:
 erb_lint:
   stage: test
   image: ruby:$RUBY_VERSION
-  variables:
-    CI: "true"
-    RAILS_ENV: test
   tags:
     - rails
   script:
@@ -39,9 +34,6 @@ erb_lint:
 haml_lint:
   stage: test
   image: ruby:$RUBY_VERSION
-  variables:
-    CI: "true"
-    RAILS_ENV: test
   tags:
     - rails
   script:
@@ -52,9 +44,6 @@ haml_lint:
 brakeman:
   stage: test
   image: ruby:$RUBY_VERSION
-  variables:
-    CI: "true"
-    RAILS_ENV: test
   tags:
     - rails
   script:
@@ -70,8 +59,6 @@ rails_test:
   services:
     - postgres:16.4
   variables:
-    CI: "true"
-    RAILS_ENV: test
     POSTGRES_DB: postgres
     POSTGRES_USER: postgres
     POSTGRES_PASSWORD: postgres