ALBS-443: Integrate CodeNotary with git updater tool #1

Merged
soksanichenko merged 10 commits from ALBS-443 into master 2022-06-22 11:07:24 +00:00
Showing only changes of commit 85764ae655 - Show all commits

View File

@ -45,19 +45,32 @@ class CasWrapper:
result_of_execution = command()
return json.loads(result_of_execution)['hash']
def authenticate(self, local_git_repo_path: str) -> bool:
def authenticate(
self,
local_path: str,
metadata: dict = None,
):
"""
Wrapper around `cas authenticate`
:param local_git_repo_path: path to a local Git repo
:param local_path: path to a local Git repo
(should be started from `git://`)
or to a single local file
:param metadata: additional metadata
:return: true if a commit is trusted, vice versa - false
:rtype: bool
"""
command = self._cas[
'authenticate',
f'git://{local_git_repo_path}',
local_path,
'-o',
'json',
]
if metadata is not None:
for key, value in metadata.items():
command = command[
'-a',
f'{key}={value}',
]
try:
result_of_execution = command()
except ProcessExecutionError: