diff options
author | Rémy Coutable <remy@rymai.me> | 2018-02-14 16:36:26 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-02-14 16:36:26 +0000 |
commit | 0a0f337c5661eb7a76dfdc49dcecc3406fcfd1b7 (patch) | |
tree | cb0c1aece3fd593c97bc8c998d6461d919e645f5 | |
parent | fa1134ea832019f74e20444fcfdf42e76195d321 (diff) | |
parent | 8bf5203bdc9d5953d73473809b65ba4166dc9913 (diff) | |
download | gitlab-ce-0a0f337c5661eb7a76dfdc49dcecc3406fcfd1b7.tar.gz |
Merge branch 'qa/rs-suppress-git-output' into 'master'
Suppress git output when running QA as a non-default user
Closes gitlab-qa#157
See merge request gitlab-org/gitlab-ce!17006
-rw-r--r-- | qa/qa/git/repository.rb | 14 | ||||
-rw-r--r-- | qa/qa/runtime/user.rb | 6 |
2 files changed, 17 insertions, 3 deletions
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb index 8eb7031f609..4c4ef3ef477 100644 --- a/qa/qa/git/repository.rb +++ b/qa/qa/git/repository.rb @@ -33,7 +33,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 @@ -61,12 +61,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 and output can be useful for debugging + return if @username == Runtime::User.default_name + + "&> #{File::NULL}" + end end end end diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb index 39e6adf9522..ecc9ab321ba 100644 --- a/qa/qa/runtime/user.rb +++ b/qa/qa/runtime/user.rb @@ -3,8 +3,12 @@ module QA module User extend self + def default_name + 'root' + end + def name - Runtime::Env.user_username || 'root' + Runtime::Env.user_username || default_name end def password |