Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/ci/build.rb17
-rw-r--r--spec/models/ci/build_spec.rb11
2 files changed, 21 insertions, 7 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index cda4fdd4982..19f957eb965 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -143,12 +143,6 @@ module Ci
html ||= ''
end
- def trace
- if project && read_attribute(:trace).present?
- read_attribute(:trace).gsub(project.token, 'xxxxxx')
- end
- end
-
def started?
!pending? && !canceled? && started_at
end
@@ -223,7 +217,7 @@ module Ci
end
end
- def trace
+ def raw_trace
if File.exist?(path_to_trace)
File.read(path_to_trace)
else
@@ -232,6 +226,15 @@ module Ci
end
end
+ def trace
+ trace = raw_trace
+ if project && trace.present?
+ trace.gsub(project.token, 'xxxxxx')
+ else
+ trace
+ end
+ end
+
def trace=(trace)
unless Dir.exists? dir_to_trace
FileUtils.mkdir_p dir_to_trace
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 82623bd8190..ca070a14975 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -178,6 +178,17 @@ describe Ci::Build do
it { is_expected.to include(text) }
it { expect(subject.length).to be >= text.length }
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
describe :timeout do