ALBS-443: Integrate CodeNotary with git updater tool

- Env vars with credentials
This commit is contained in:
soksanichenko 2022-06-21 11:04:31 +03:00
parent f46eef7df9
commit 646b984d89
1 changed files with 16 additions and 4 deletions

View File

@ -54,7 +54,11 @@ class CasWrapper:
'-a',
f'{key}={value}',
]
result_of_execution = command()
with local.env(
CAS_API_KEY=self._cas_api_key,
SIGNER_ID=self._cas_signer_id
):
result_of_execution = command()
return json.loads(result_of_execution)['hash']
def authenticate(
@ -76,8 +80,16 @@ class CasWrapper:
'json',
]
try:
result_of_execution = command()
with local.env(
CAS_API_KEY=self._cas_api_key,
SIGNER_ID=self._cas_signer_id
):
result_of_execution = command()
except ProcessExecutionError:
# in case if commit is untrusted
result_of_execution = command(retcode=1)
with local.env(
CAS_API_KEY=self._cas_api_key,
SIGNER_ID=self._cas_signer_id
):
# in case if commit is untrusted
result_of_execution = command(retcode=1)
return not bool(json.loads(result_of_execution)['status'])