Commit 9eb96f46 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'revert-a496b58e' into 'master'

Revert "Merge branch 'use-ref-instead-of-sha-in-pipeline-config-for-variables' into 'master'"

See merge request gitlab-org/gitlab!67361
parents 6a1d05d4 5ca4e1ec
...@@ -20,7 +20,7 @@ module Gitlab ...@@ -20,7 +20,7 @@ module Gitlab
attr_reader :root, :context, :ref, :source attr_reader :root, :context, :ref, :source
def initialize(config, project: nil, sha: nil, user: nil, parent_pipeline: nil, ref: nil, source: nil) def initialize(config, project: nil, sha: nil, user: nil, parent_pipeline: nil, ref: nil, source: nil)
@context = build_context(project: project, sha: sha, user: user, parent_pipeline: parent_pipeline, ref: ref) @context = build_context(project: project, sha: sha, user: user, parent_pipeline: parent_pipeline)
@context.set_deadline(TIMEOUT_SECONDS) @context.set_deadline(TIMEOUT_SECONDS)
@ref = ref @ref = ref
...@@ -108,13 +108,13 @@ module Gitlab ...@@ -108,13 +108,13 @@ module Gitlab
end end
end end
def build_context(project:, sha:, user:, parent_pipeline:, ref:) def build_context(project:, sha:, user:, parent_pipeline:)
Config::External::Context.new( Config::External::Context.new(
project: project, project: project,
sha: sha || find_sha(project), sha: sha || find_sha(project),
user: user, user: user,
parent_pipeline: parent_pipeline, parent_pipeline: parent_pipeline,
variables: build_variables(project: project, ref: ref)) variables: build_variables(project: project, ref: sha))
end end
def build_variables(project:, ref:) def build_variables(project:, ref:)
......
...@@ -107,6 +107,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Populate do ...@@ -107,6 +107,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Populate do
context 'when ref is protected' do context 'when ref is protected' do
before do before do
allow(project).to receive(:protected_for?).with('master').and_return(true) allow(project).to receive(:protected_for?).with('master').and_return(true)
allow(project).to receive(:protected_for?).with('b83d6e391c22777fca1ed3012fce84f633d7fed0').and_return(true)
allow(project).to receive(:protected_for?).with('refs/heads/master').and_return(true) allow(project).to receive(:protected_for?).with('refs/heads/master').and_return(true)
dependencies.map(&:perform!) dependencies.map(&:perform!)
......
...@@ -1328,7 +1328,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -1328,7 +1328,7 @@ RSpec.describe Ci::CreatePipelineService do
end end
context 'when ref is tag' do context 'when ref is tag' do
let(:ref_name) { 'refs/tags/v1.0.0' } let(:ref_name) { 'refs/tags/v1.1.0' }
it 'does not create an extrnal pull request pipeline', :aggregate_failures do it 'does not create an extrnal pull request pipeline', :aggregate_failures do
expect(response).to be_error expect(response).to be_error
...@@ -1516,7 +1516,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -1516,7 +1516,7 @@ RSpec.describe Ci::CreatePipelineService do
end end
context 'when ref is tag' do context 'when ref is tag' do
let(:ref_name) { 'refs/tags/v1.0.0' } let(:ref_name) { 'refs/tags/v1.1.0' }
it 'does not create a merge request pipeline', :aggregate_failures do it 'does not create a merge request pipeline', :aggregate_failures do
expect(response).to be_error expect(response).to be_error
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment