summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-02-08 10:11:04 -0600
committerRobert Speicher <rspeicher@gmail.com>2018-02-13 11:19:02 -0600
commit25ac4483c0fdedc4a8e38289727ad2bb76fe7b15 (patch)
treee68b2698ba911b8277f985daecb77b20a28b8908
parent333b6eabd1c9f994c2801149e8d49b3f2cdd536c (diff)
downloadgitlab-ce-qa/rs-suppress-git-output.tar.gz
Suppress git output when running QA as a non-default userqa/rs-suppress-git-output
-rw-r--r--qa/qa/git/repository.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb
index 8f999511d58..8b83a976a79 100644
--- a/qa/qa/git/repository.rb
+++ b/qa/qa/git/repository.rb
@@ -32,7 +32,7 @@ module QA
end
def clone(opts = '')
- `git clone #{opts} #{@uri.to_s} ./`
+ `git clone #{opts} #{@uri.to_s} ./ #{suppress_output}`
end
def shallow_clone
@@ -60,12 +60,22 @@ module QA
end
def push_changes(branch = 'master')
- `git push #{@uri.to_s} #{branch}`
+ `git push #{@uri.to_s} #{branch} #{suppress_output}`
end
def commits
`git log --oneline`.split("\n")
end
+
+ private
+
+ def suppress_output
+ # If we're running as the default user, it's probably a temporary
+ # instance we don't care about leaking credentials for
+ return if @username == Runtime::User.default_name
+
+ "&> #{File::NULL}"
+ end
end
end
end