-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e81ba0a
commit bd44584
Showing
2 changed files
with
14 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ | |
|
||
_logger = logging.getLogger(__name__) | ||
|
||
# GIT | ||
GIT_ADDRESS_HTTPS = "https://github.com/{path}.git" | ||
GIT_ADDRESS_SSH = "[email protected]:{path}.git" | ||
|
||
GIT_ERROR_TABLE = { | ||
2: { | ||
'level': 'fatal', | ||
|
@@ -18,6 +22,7 @@ | |
} | ||
} | ||
|
||
|
||
def _rais_git_error(context, error_code): | ||
if not error_code: | ||
return | ||
|
@@ -26,13 +31,13 @@ def _rais_git_error(context, error_code): | |
'message': "Unknown GIT error for distination path {path}. Error code is {error_code}. " | ||
"See .otoolbox/logs.text for more information." | ||
}) | ||
message = error['message'].format(error_code=error_code,**context.__dict__) | ||
message = error['message'].format(error_code=error_code, **context.__dict__) | ||
if env.context.get('continue_on_exception'): | ||
_logger.error(message) | ||
env.errors.append(message) | ||
else: | ||
raise RuntimeError( | ||
error['message'].format(error_code=error_code,**context.__dict__) | ||
error['message'].format(error_code=error_code, **context.__dict__) | ||
) | ||
|
||
|
||
|
@@ -48,13 +53,13 @@ def git_clone(context): | |
'clone', | ||
'--branch', branch_name, | ||
'--depth', depth, | ||
f"[email protected]:{context.path}.git" | ||
(GIT_ADDRESS_HTTPS if not env.context.get('ssh_git', False) | ||
else GIT_ADDRESS_SSH).format(path=context.path), | ||
], cwd=cwd) | ||
|
||
_rais_git_error(context=context, error_code=result) | ||
|
||
|
||
|
||
def git_pull(context): | ||
"""Pull the git repository from github | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters