Commit 353c5782 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Checkout to a new branch

parent 1fe57d3f
......@@ -30,7 +30,12 @@ module QA
repository.clone
repository.configure_identity('GitLab QA', 'root@gitlab.com')
repository.checkout(@branch_name) unless @new_branch
if @new_branch
repository.checkout_new_branch(@branch_name)
else
repository.checkout(@branch_name)
end
repository.add_file(@file_name, @file_content)
repository.commit(@commit_message)
repository.push_changes(@branch_name)
......
......@@ -40,6 +40,10 @@ module QA
`git checkout "#{branch_name}"`
end
def checkout_new_branch(branch_name)
`git checkout -b "#{branch_name}"`
end
def shallow_clone
clone('--depth 1')
end
......
......@@ -74,6 +74,7 @@ module QA
resource.commit_message = 'Add .gitlab-ci.yml'
resource.file_content = gitlab_ci
resource.branch_name = deploy_key_name
resource.new_branch = true
end
sha1sum = Digest::SHA1.hexdigest(gitlab_ci)
......
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