|
|
@@ -59,10 +59,16 @@ func (c *ListDeploymentsByClusterHandler) ServeHTTP(w http.ResponseWriter, r *ht
|
|
|
|
|
|
env, err := c.Repo().Environment().ReadEnvironmentByID(project.ID, cluster.ID, deployment.EnvironmentID)
|
|
|
|
|
|
- if err == nil {
|
|
|
- updateDeploymentWithGithubWorkflowRunStatus(r.Context(), c.Config(), env, deployment)
|
|
|
+ if err != nil {
|
|
|
+ c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
+ updateDeploymentWithGithubWorkflowRunStatus(r.Context(), c.Config(), env, deployment)
|
|
|
+
|
|
|
+ deployment.InstallationID = env.GitInstallationID
|
|
|
+ deployment.WorkflowFilename = fmt.Sprintf("porter_%s_env.yml", env.Name)
|
|
|
+
|
|
|
deployments = append(deployments, deployment)
|
|
|
}
|
|
|
|
|
|
@@ -108,6 +114,9 @@ func (c *ListDeploymentsByClusterHandler) ServeHTTP(w http.ResponseWriter, r *ht
|
|
|
|
|
|
updateDeploymentWithGithubWorkflowRunStatus(r.Context(), c.Config(), env, deployment)
|
|
|
|
|
|
+ deployment.InstallationID = env.GitInstallationID
|
|
|
+ deployment.WorkflowFilename = fmt.Sprintf("porter_%s_env.yml", env.Name)
|
|
|
+
|
|
|
deployments = append(deployments, deployment)
|
|
|
}
|
|
|
|
|
|
@@ -140,6 +149,10 @@ func updateDeploymentWithGithubWorkflowRunStatus(
|
|
|
ctx, deployment.RepoOwner, deployment.RepoName,
|
|
|
fmt.Sprintf("porter_%s_env.yml", env.Name), &github.ListWorkflowRunsOptions{
|
|
|
Branch: deployment.PRBranchFrom,
|
|
|
+ ListOptions: github.ListOptions{
|
|
|
+ Page: 1,
|
|
|
+ PerPage: 1,
|
|
|
+ },
|
|
|
},
|
|
|
)
|
|
|
|
|
|
@@ -148,9 +161,9 @@ func updateDeploymentWithGithubWorkflowRunStatus(
|
|
|
|
|
|
deployment.LastWorkflowRunURL = latestWorkflowRun.GetHTMLURL()
|
|
|
|
|
|
- if deployment.Status != types.DeploymentStatusCreating &&
|
|
|
- (latestWorkflowRun.GetStatus() == "in_progress" ||
|
|
|
- latestWorkflowRun.GetStatus() == "queued") {
|
|
|
+ if (latestWorkflowRun.GetStatus() == "in_progress" ||
|
|
|
+ latestWorkflowRun.GetStatus() == "queued") &&
|
|
|
+ deployment.Status != types.DeploymentStatusCreating {
|
|
|
deployment.Status = types.DeploymentStatusUpdating
|
|
|
} else if latestWorkflowRun.GetStatus() == "completed" {
|
|
|
if latestWorkflowRun.GetConclusion() == "failed" {
|