ALBS-443: Integrate CodeNotary with git updater tool

- Additional metadata for notarizing
This commit is contained in:
soksanichenko 2022-06-21 09:56:58 +03:00
parent 1fcbac41b1
commit 85764ae655
1 changed files with 16 additions and 3 deletions

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: