mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-20 14:11:11 +00:00
Add latest changes from gitlab-org/gitlab@17-11-stable-ee
This commit is contained in:
@ -54,7 +54,7 @@ module Ci
|
||||
|
||||
override :coerced_value
|
||||
def coerced_value(value)
|
||||
super.to_s
|
||||
value.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'fast_spec_helper'
|
||||
require 'oj'
|
||||
require_relative Rails.root.join('lib/ci/pipeline_creation/inputs/spec_inputs.rb')
|
||||
|
||||
RSpec.describe Ci::PipelineCreation::Inputs::SpecInputs, feature_category: :pipeline_composition do
|
||||
|
@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'fast_spec_helper'
|
||||
require 'oj'
|
||||
require_relative Rails.root.join('lib/gitlab/ci/config/interpolation/inputs.rb')
|
||||
|
||||
RSpec.describe Gitlab::Ci::Config::Interpolation::Inputs, feature_category: :pipeline_composition do
|
||||
@ -195,6 +196,16 @@ RSpec.describe Gitlab::Ci::Config::Interpolation::Inputs, feature_category: :pip
|
||||
expect(inputs.to_hash).to eq(foo: 'bar')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a hash value is passed as string' do
|
||||
let(:specs) { { test_input: { type: 'string' } } }
|
||||
let(:args) { { test_input: '{"key": "value"}' } }
|
||||
|
||||
it 'is valid and behaves like an unparsed string' do
|
||||
expect(inputs).to be_valid
|
||||
expect(inputs.to_hash).to eq(test_input: '{"key": "value"}')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'number validation' do
|
||||
|
@ -889,10 +889,14 @@ RSpec.describe API::Ci::Pipelines, feature_category: :continuous_integration do
|
||||
{ 'Content-Type' => 'application/x-www-form-urlencoded' }
|
||||
end
|
||||
|
||||
let(:transformed_values) do
|
||||
inputs.transform_values { |value| value.is_a?(String) ? value : value.to_json }
|
||||
end
|
||||
|
||||
subject(:post_request) do
|
||||
post api("/projects/#{project.id}/pipeline", user),
|
||||
headers: headers,
|
||||
params: { ref: project.default_branch, inputs: inputs.transform_values(&:to_json) }
|
||||
params: { ref: project.default_branch, inputs: transformed_values }
|
||||
end
|
||||
|
||||
it_behaves_like 'creating a succesful pipeline'
|
||||
|
@ -237,10 +237,14 @@ RSpec.describe API::Ci::Triggers, feature_category: :pipeline_composition do
|
||||
{ 'Content-Type' => 'application/x-www-form-urlencoded' }
|
||||
end
|
||||
|
||||
let(:transformed_values) do
|
||||
inputs.transform_values { |value| value.is_a?(String) ? value : value.to_json }
|
||||
end
|
||||
|
||||
subject(:post_request) do
|
||||
post api("/projects/#{project.id}/ref/master/trigger/pipeline?token=#{token}"),
|
||||
headers: headers,
|
||||
params: { ref: 'refs/heads/other-branch', inputs: inputs.transform_values(&:to_json) }
|
||||
params: { ref: 'refs/heads/other-branch', inputs: transformed_values }
|
||||
end
|
||||
|
||||
it_behaves_like 'creating a succesful pipeline'
|
||||
|
Reference in New Issue
Block a user