Commit 91532018 authored by Ash McKenzie's avatar Ash McKenzie

Support for using git-lfs

parent 82df60dd
......@@ -11,7 +11,7 @@ module QA
class Repository
include Scenario::Actable
attr_writer :password
attr_writer :password, :use_lfs
attr_accessor :env_vars
def initialize
......@@ -134,12 +134,27 @@ module QA
private
attr_reader :uri, :username, :password, :known_hosts_file, :private_key_file
attr_reader :uri, :username, :password, :known_hosts_file,
:private_key_file, :use_lfs
alias_method :use_lfs?, :use_lfs
def ssh_key_set?
!private_key_file.nil?
end
def enable_lfs
# git lfs install *needs* a .gitconfig defined at ${HOME}/.gitconfig
FileUtils.mkdir_p(tmp_home_dir)
touch_gitconfig_result = run("touch #{tmp_home_dir}/.gitconfig")
return touch_gitconfig_result.response unless touch_gitconfig_result.success?
git_lfs_install_result = run('git lfs install')
touch_gitconfig_result.to_s + git_lfs_install_result.to_s
end
def run(command_str, *extra_env)
command = [env_vars, *extra_env, command_str, '2>&1'].compact.join(' ')
Runtime::Logger.debug "Git: command=[#{command}]"
......
......@@ -8,7 +8,7 @@ module QA
class Push < Base
attr_accessor :file_name, :file_content, :commit_message,
:branch_name, :new_branch, :output, :repository_http_uri,
:repository_ssh_uri, :ssh_key, :user
:repository_ssh_uri, :ssh_key, :user, :use_lfs
attr_writer :remote_branch
......@@ -24,6 +24,7 @@ module QA
@new_branch = true
@repository_http_uri = ""
@ssh_key = nil
@use_lfs = false
end
def remote_branch
......@@ -58,6 +59,8 @@ module QA
repository.use_default_credentials unless user
end
repository.use_lfs = use_lfs
username = 'GitLab QA'
email = 'root@gitlab.com'
......
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