Skip to content

Commit

Permalink
add support for ignoring test hook from helm v3 (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
justmike1 authored Dec 5, 2023
1 parent b9aeb72 commit ef3dfa3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions marketplace/deployer_util/process_helm_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
a given manifest file. '''

_HELM_HOOK_KEY = 'helm.sh/hook'
_HOOK_SUCCESS = 'test-success'
_HOOK_FAILURE = 'test-failure'

_HOOK_SUCCESS = ['test-success', 'test']
_HOOK_FAILURE = ['test-failure', 'test']

def main():
parser = ArgumentParser()
Expand All @@ -45,13 +44,13 @@ def main():
helm_hook = deep_get(resource, "metadata", "annotations", _HELM_HOOK_KEY)
if helm_hook is None:
filtered_resources.append(resource)
elif helm_hook == _HOOK_SUCCESS:
elif _HOOK_SUCCESS.index(helm_hook):
if args.deploy_tests:
annotations = deep_get(resource, "metadata", "annotations")
del annotations[_HELM_HOOK_KEY]
annotations[GOOGLE_CLOUD_TEST] = "test"
filtered_resources.append(resource)
elif helm_hook == _HOOK_FAILURE:
elif _HOOK_FAILURE.index(helm_hook):
if args.deploy_tests:
raise Exception("Helm hook {} is not supported".format(helm_hook))
else:
Expand Down

0 comments on commit ef3dfa3

Please sign in to comment.