Skip to content

Commit

Permalink
Added http clone on ssh fail on merge-lektor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaume Florez committed Sep 6, 2016
1 parent c097e93 commit dbe7927
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions hookshub/hooks/gitlab/merge_request_lektor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,28 @@ def arguments():

if new_clone.returncode != 0:
# Could not clone >< => ABORT
output += 'FAILED TO CLONE: {}:'.format(out)
print(output)
output += 'FAILED TO CLONE: {}: | Trying to clone from https ' \
'...'.format(out)
sys.stderr.write(
'[merge_request_lektor]:clone_repository_fail::{}'.format(err)
)
exit(-1)
url = payload['http_url']
if source_branch != 'None':
output += "Clonant el repositori '{0}', amb la branca '{1}'" \
" ...".format(repo_name, source_branch)
command = 'git clone {0} --branch {1}'.format(url, source_branch)
else:
output += "Clonant el repositori '{0}' ...".format(repo_name)
command = 'git clone {}'.format(url)

new_clone = Popen(
command.split(), cwd=tmp_dir, stdout=PIPE, stderr=PIPE
)
out, err = new_clone.communicate()

if new_clone.returncode != 0:
print(output)
exit(-1)

output += 'OK |'

Expand Down

0 comments on commit dbe7927

Please sign in to comment.