From 3887a27f67283a00f3d93a5576223412cba285cc Mon Sep 17 00:00:00 2001 From: Rafael Jesus Date: Wed, 2 Feb 2022 19:17:28 +0100 Subject: [PATCH] add skip_kubectl_config_init to helm step --- graduated/helm/lib/EntrypointScriptBuilder.py | 3 ++- graduated/helm/step.yaml | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/graduated/helm/lib/EntrypointScriptBuilder.py b/graduated/helm/lib/EntrypointScriptBuilder.py index a43b271e8..c32ebab2a 100644 --- a/graduated/helm/lib/EntrypointScriptBuilder.py +++ b/graduated/helm/lib/EntrypointScriptBuilder.py @@ -28,6 +28,7 @@ def __init__(self, env): self.chart = env.get('CHART_JSON') self.helm_version = env.get('HELM_VERSION') self.azure_helm_token = None + self.skip_kubectl_config_init = env.get('SKIP_KUBECTL_CONFIG_INIT') # Save chart data in files if not self.chart is None: @@ -173,7 +174,7 @@ def _get_azure_service_principal_helm_token(self, repo_url): def _build_kubectl_commands(self): lines = [] - if self.action in ['install', 'promotion', 'auth']: + if self.action in ['install', 'promotion', 'auth'] and not self.skip_kubectl_config_init: if self.kube_context is None: raise Exception('Must set KUBE_CONTEXT in environment (Name of Kubernetes cluster as named in Codefresh)') kubectl_cmd = 'kubectl config use-context "%s"' % self.kube_context diff --git a/graduated/helm/step.yaml b/graduated/helm/step.yaml index c33e63ead..447e3d495 100644 --- a/graduated/helm/step.yaml +++ b/graduated/helm/step.yaml @@ -190,7 +190,11 @@ spec: "chart_subdir": { "type": "string", "description": "optional subfolder (inside JFrog Artifactory helm repository)" - } + }, + "skip_kubectl_config_init": { + "type": "boolean", + "description": "Don't run kubectl config use-context " + }, } } stepsTemplate: |-