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

View File

@ -45,19 +45,32 @@ class CasWrapper:
result_of_execution = command() result_of_execution = command()
return json.loads(result_of_execution)['hash'] 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` 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 :return: true if a commit is trusted, vice versa - false
:rtype: bool :rtype: bool
""" """
command = self._cas[ command = self._cas[
'authenticate', 'authenticate',
f'git://{local_git_repo_path}', local_path,
'-o', '-o',
'json', 'json',
] ]
if metadata is not None:
for key, value in metadata.items():
command = command[
'-a',
f'{key}={value}',
]
try: try:
result_of_execution = command() result_of_execution = command()
except ProcessExecutionError: except ProcessExecutionError: