BigW Consortium Gitlab

Commit 11485306 by Kamil Trzciński

Merge branch 'ci-fixes' into 'master'

CI: Fix clone url and fix project token removal - Fixes broken CI clone url on dev.gitlab.org - Fixes regression in CI token removal /cc @vsizov @dzaporozhets See merge request !1481
parents b5654eb4 0e548473
...@@ -143,12 +143,6 @@ module Ci ...@@ -143,12 +143,6 @@ module Ci
html ||= '' html ||= ''
end end
def trace
if project && read_attribute(:trace).present?
read_attribute(:trace).gsub(project.token, 'xxxxxx')
end
end
def started? def started?
!pending? && !canceled? && started_at !pending? && !canceled? && started_at
end end
...@@ -223,7 +217,7 @@ module Ci ...@@ -223,7 +217,7 @@ module Ci
end end
end end
def trace def raw_trace
if File.exist?(path_to_trace) if File.exist?(path_to_trace)
File.read(path_to_trace) File.read(path_to_trace)
else else
...@@ -232,6 +226,15 @@ module Ci ...@@ -232,6 +226,15 @@ module Ci
end end
end end
def trace
trace = raw_trace
if project && trace.present?
trace.gsub(project.token, 'xxxxxx')
else
trace
end
end
def trace=(trace) def trace=(trace)
unless Dir.exists? dir_to_trace unless Dir.exists? dir_to_trace
FileUtils.mkdir_p dir_to_trace FileUtils.mkdir_p dir_to_trace
......
...@@ -169,8 +169,7 @@ module Ci ...@@ -169,8 +169,7 @@ module Ci
# using http and basic auth # using http and basic auth
def repo_url_with_auth def repo_url_with_auth
auth = "gitlab-ci-token:#{token}@" auth = "gitlab-ci-token:#{token}@"
url = http_url_to_repo + ".git" http_url_to_repo.sub(/^https?:\/\//) do |prefix|
url.sub(/^https?:\/\//) do |prefix|
prefix + auth prefix + auth
end end
end end
......
...@@ -178,6 +178,17 @@ describe Ci::Build do ...@@ -178,6 +178,17 @@ describe Ci::Build do
it { is_expected.to include(text) } it { is_expected.to include(text) }
it { expect(subject.length).to be >= text.length } it { expect(subject.length).to be >= text.length }
end end
context 'if build.trace hides token' do
let(:token) { 'my_secret_token' }
before do
build.project.update_attributes(token: token)
build.update_attributes(trace: token)
end
it { is_expected.to_not include(token) }
end
end end
describe :timeout do describe :timeout do
......
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