BuildOn UI "Individual Build Report"- Status "Initiated"

Problem

In BuildOn UI, "Individual Build Report" → "Individual Build Metadata" Status field is "Initiated" and not changing to any of the next status "In progress/Success/Failure"

Cause

dbupdate.py is inserting the live status to Database. In this scenario, it is not updated due to kube api curl result error in the same file.

Fix

In few environments, externalized variables like "k8s_namespace" & "k8s_serviceaccount" using os.environ is not fetching the values. In such case, use the namespace and servceaccount names directly.

For example:

AS-IS:

result = os.popen("curl -k -s `(kubectl config view | grep server | cut -f 2- -d \":\" | tr -d \" \")`/api/v1/namespaces/"+k8s_namespace+"/pods --header \"Authorization: Bearer `(kubectl describe secret $(kubectl get secrets | grep "+k8s_serviceaccount+" | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t')`\"").read()

TO-BE:

result = os.popen("curl -k -s `(kubectl config view | grep server | cut -f 2- -d \":\" | tr -d \" \")`/api/v1/namespaces/default/pods --header \"Authorization: Bearer `(kubectl describe secret $(kubectl get secrets | grep default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t')`\"").read()