Commit 1e54f727 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'revert-12030b45' into 'master'

Revert "Merge branch '326106-correlation-id-to-validation-service' into 'master'"

See merge request gitlab-org/gitlab!58695
parents 251a396f 4b4b1db6
---
title: Add correlation id in X-Request-ID for external pipeline validation
merge_request: 58486
author:
type: other
...@@ -69,10 +69,8 @@ module Gitlab ...@@ -69,10 +69,8 @@ module Gitlab
end end
def validate_service_request def validate_service_request
headers = { headers = {}
'X-Request-ID' => Labkit::Correlation::CorrelationId.current_id, headers['X-Gitlab-Token'] = validation_service_token if validation_service_token
'X-Gitlab-Token' => validation_service_token
}.compact
Gitlab::HTTP.post( Gitlab::HTTP.post(
validation_service_url, timeout: validation_service_timeout, validation_service_url, timeout: validation_service_timeout,
......
...@@ -127,23 +127,13 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do ...@@ -127,23 +127,13 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do
it 'passes token in X-Gitlab-Token header' do it 'passes token in X-Gitlab-Token header' do
expect(::Gitlab::HTTP).to receive(:post) do |_url, params| expect(::Gitlab::HTTP).to receive(:post) do |_url, params|
expect(params[:headers]).to include({ 'X-Gitlab-Token' => '123' }) expect(params[:headers]).to eq({ 'X-Gitlab-Token' => '123' })
end end
perform! perform!
end end
end end
it 'passes the correlation id in X-Request-ID header' do
allow(Labkit::Correlation::CorrelationId).to receive(:current_id).and_return('correlation-id')
expect(::Gitlab::HTTP).to receive(:post) do |_url, params|
expect(params[:headers]).to include({ 'X-Request-ID' => 'correlation-id' })
end
perform!
end
context 'when validation returns 200 OK' do context 'when validation returns 200 OK' do
before do before do
stub_request(:post, validation_service_url).to_return(status: 200, body: "{}") stub_request(:post, validation_service_url).to_return(status: 200, body: "{}")
......
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