Skip to content

Commit

Permalink
helm revision number (#4536)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-g-town authored Apr 15, 2024
1 parent cacd76f commit 900f3d7
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions api/server/handlers/porter_app/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (c *GetPorterAppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
defer span.End()

cluster, _ := ctx.Value(types.ClusterScope).(*models.Cluster)
project, _ := ctx.Value(types.ProjectScope).(*models.Project)

appName, reqErr := requestutils.GetURLParamString(r, types.URLParamPorterAppName)
if reqErr != nil {
Expand All @@ -60,19 +61,24 @@ func (c *GetPorterAppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
return
}

namespace := fmt.Sprintf("app-%s", app.Name)
helmAgent, err := c.GetHelmAgent(ctx, r, cluster, namespace)
if err != nil {
err = telemetry.Error(ctx, span, err, "error getting helm agent")
c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError))
return
}
helmRelease, err := helmAgent.GetRelease(ctx, appName, 0, false)
if err != nil {
err = telemetry.Error(ctx, span, err, "error getting helm release for app")
c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError))
if project.ID == 10004 || project.ID == 9952 {
namespace := fmt.Sprintf("app-%s", app.Name)
helmAgent, err := c.GetHelmAgent(ctx, r, cluster, namespace)
if err != nil {
err = telemetry.Error(ctx, span, err, "error getting helm agent")
c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError))
return
}
helmRelease, err := helmAgent.GetRelease(ctx, appName, 0, false)
if err != nil {
err = telemetry.Error(ctx, span, err, "error getting helm release for app")
c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError))
return
}

c.WriteResult(w, r, app.ToPorterAppTypeWithRevision(helmRelease.Version))
return
}

c.WriteResult(w, r, app.ToPorterAppTypeWithRevision(helmRelease.Version))
c.WriteResult(w, r, app.ToPorterAppType())
}

0 comments on commit 900f3d7

Please sign in to comment.