Selaa lähdekoodia

Merge pull request #2261 from porter-dev/staging

Nil pointer exception + sidebar fix -> production
abelanger5 3 vuotta sitten
vanhempi
sitoutus
1bf191e50b

+ 15 - 15
api/server/handlers/environment/finalize_deployment.go

@@ -150,21 +150,21 @@ func (c *FinalizeDeploymentHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
 		c.Config().ServerConf.ServerURL, depl.Namespace, depl.EnvironmentID, project.ID, url.QueryEscape(cluster.Name),
 	)
 
-	if len(request.SuccessfulResources) > 0 {
-		commentBody += "\n#### Successfully deployed resources\n"
-
-		for _, res := range request.SuccessfulResources {
-			if res.ReleaseType == "job" {
-				commentBody += fmt.Sprintf("- [`%s`](%s/jobs/%s/%s/%s?project_id=%d)\n",
-					res.ReleaseName, c.Config().ServerConf.ServerURL, cluster.Name, depl.Namespace,
-					res.ReleaseName, project.ID)
-			} else {
-				commentBody += fmt.Sprintf("- [`%s`](%s/applications/%s/%s/%s?project_id=%d)\n",
-					res.ReleaseName, c.Config().ServerConf.ServerURL, cluster.Name, depl.Namespace,
-					res.ReleaseName, project.ID)
-			}
-		}
-	}
+	// if len(request.SuccessfulResources) > 0 {
+	// 	commentBody += "\n#### Successfully deployed resources\n"
+
+	// 	for _, res := range request.SuccessfulResources {
+	// 		if res.ReleaseType == "job" {
+	// 			commentBody += fmt.Sprintf("- [`%s`](%s/jobs/%s/%s/%s?project_id=%d)\n",
+	// 				res.ReleaseName, c.Config().ServerConf.ServerURL, cluster.Name, depl.Namespace,
+	// 				res.ReleaseName, project.ID)
+	// 		} else {
+	// 			commentBody += fmt.Sprintf("- [`%s`](%s/applications/%s/%s/%s?project_id=%d)\n",
+	// 				res.ReleaseName, c.Config().ServerConf.ServerURL, cluster.Name, depl.Namespace,
+	// 				res.ReleaseName, project.ID)
+	// 		}
+	// 	}
+	// }
 
 	err = createOrUpdateComment(client, c.Repo(), env.NewCommentsDisabled, depl, github.String(commentBody))
 

+ 2 - 1
cli/cmd/docker/agent.go

@@ -291,7 +291,8 @@ func (a *Agent) PullImage(image string) error {
 	out, err := a.ImagePull(a.ctx, image, opts)
 
 	if err != nil {
-		if client.IsErrNotFound(err) {
+		if client.IsErrNotFound(err) ||
+			(strings.Contains(image, "gcr.io") && strings.Contains(err.Error(), "or it may not exist")) {
 			return PullImageErrNotFound
 		} else if client.IsErrUnauthorized(err) {
 			return PullImageErrUnauthorized

+ 10 - 3
dashboard/src/main/home/sidebar/SidebarLink.tsx

@@ -18,20 +18,27 @@ const SidebarLink: React.FC<{ path: string } & Omit<NavLinkProps, "to">> = ({
    */
   const withQueryParams = (path: string) => (location: any) => {
     let pathNamespace = params.namespace;
-    let search = `?cluster=${currentCluster.name}&project_id=${currentProject.id}`;
+    const search = new URLSearchParams();
+    if (currentCluster?.name) {
+      search.append("cluster", currentCluster.name);
+    }
+
+    if (currentProject?.id) {
+      search.append("project_id", String(currentProject.id));
+    }
 
     if (!pathNamespace) {
       pathNamespace = getQueryParam("namespace");
     }
 
     if (pathNamespace) {
-      search = search.concat(`&namespace=${pathNamespace}`);
+      search.append("namespace", pathNamespace);
     }
 
     return {
       ...location,
       pathname: path,
-      search,
+      search: search.toString(),
     };
   };
 

+ 3 - 1
internal/registry/registry.go

@@ -707,7 +707,9 @@ func (r *Registry) GetECRPaginatedImages(
 	imageIDMap := make(map[string]bool)
 
 	for _, id := range resp.ImageIds {
-		imageIDMap[*id.ImageTag] = true
+		if id != nil && id.ImageTag != nil {
+			imageIDMap[*id.ImageTag] = true
+		}
 	}
 
 	var wg sync.WaitGroup