diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 1146028b9a9b12af98f6e2c1f08a85e2a6737ad4..85ef0523b31c0f84f68f6e45046f23bfec38b4d1 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -147,8 +147,7 @@ module Ci
     end
 
     def variables
-      (predefined_variables + yaml_variables + project_variables + trigger_variables)
-        .reverse.uniq { |var| var[:key] }.reverse
+      predefined_variables + yaml_variables + project_variables + trigger_variables
     end
 
     def merge_request
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index 5ee40c2253610280fda99beb26c2c88d3777b686..b5d356aa06697eda31754b55a9162e991dabfe36 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -253,19 +253,6 @@ describe Ci::Build, models: true do
               )
             end
           end
-
-          context 'when job variable has same key other variable has' do
-            let(:build) { create(:ci_build, name: 'production') }
-
-            it 'contains job yaml variable' do
-              expect(subject).to include(key: :DB_NAME, value: 'mysql',
-                                         public: true)
-            end
-
-            it 'contains only one variable with this key' do
-              expect(subject.count { |var| var[:key] == :DB_NAME } ).to eq 1
-            end
-          end
         end
       end
     end