Enabling helm3 Support for xapp-onboarder. Added env variable in Dockerfile & used... 33/5033/3
authorAlok Bhatt <alok_bh@hcl.com>
Wed, 11 Nov 2020 06:40:32 +0000 (06:40 +0000)
committerAlok Bhatt <alok_bh@hcl.com>
Tue, 17 Nov 2020 08:03:19 +0000 (08:03 +0000)
Issue-ID: RIC-679
Signed-off-by: Alok Bhatt <alok_bh@hcl.com>
Change-Id: I197c665241d477eb1606de454c0f08c8af1ce234

ci/xapp_onboarder/Dockerfile
xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py

index 28a72b1..3f594c4 100644 (file)
 FROM python:3.7-alpine
 
 ADD ./xapp_onboarder /opt/xapp_onboarder
-
 RUN cd /opt/xapp_onboarder && pip3 install . && rm -r /opt/xapp_onboarder
 
 ARG HELM_VERSION="2.12.3"
+ENV HELM_VERSION=${HELM_VERSION}
 
-RUN wget https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz && tar -xvf helm-v${HELM_VERSION}-linux-amd64.tar.gz && mv linux-amd64/helm /usr/local/bin/helm && rm -r linux-amd64 && rm helm-v${HELM_VERSION}-linux-amd64.tar.gz
+RUN wget https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz && tar -xvf helm-v${HELM_VERSION}-linux-amd64.tar.gz && mv linux-amd64/helm /usr/local/bin/helm && rm -r linux-amd64 && rm helm-v${HELM_VERSION}-linux-amd64.tar.gz
 
 ENTRYPOINT ["xapp_onboarder"]
index ab314ad..da9f34a 100644 (file)
@@ -209,7 +209,12 @@ class xApp():
         self.change_chart_name_version()
         self.helm_lint()
         try:
-            process = subprocess.run([self.helm_client_path, "package", self.chart_workspace_path + "/" + self.chart_name, "-d"
+
+            if settings.HELM_VERSION.startswith("3") == True: 
+                process = subprocess.run([self.helm_client_path, "package", self.chart_workspace_path + "/" + self.chart_name, "-d"
+                                 ,self.chart_workspace_path], stdout=PIPE, stderr=PIPE, check=True)
+            else:
+                process = subprocess.run([self.helm_client_path, "package", self.chart_workspace_path + "/" + self.chart_name, "-d"
                                ,self.chart_workspace_path,"--save=false"], stdout=PIPE, stderr=PIPE, check=True)
 
         except OSError as err: