Sfoglia il codice sorgente

Merge branch 'nafees/preview-env-metadata' into dev

Mohammed Nafees 3 anni fa
parent
commit
9c4f9517b9

+ 5 - 0
api/server/handlers/environment/delete.go

@@ -79,6 +79,11 @@ func (c *DeleteEnvironmentHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ
 		if !isSystemNamespace(depl.Namespace) {
 			agent.DeleteNamespace(depl.Namespace)
 		}
+
+		if _, err := c.Repo().Environment().DeleteDeployment(depl); err != nil {
+			c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
+			return
+		}
 	}
 
 	ghWebhookID := env.GithubWebhookID

+ 14 - 10
api/server/handlers/webhook/github_incoming.go

@@ -370,23 +370,27 @@ func (c *GithubIncomingWebhookHandler) processPushEvent(event *github.PushEvent,
 
 	envType := env.ToEnvironmentType()
 
+	if len(envType.GitDeployBranches) == 0 {
+		return nil
+	}
+
 	branch := strings.TrimPrefix(event.GetRef(), "refs/heads/")
 
-	if len(envType.GitDeployBranches) > 0 {
-		found := false
+	fmt.Println(envType.GitDeployBranches)
 
-		for _, br := range envType.GitDeployBranches {
-			if br == branch {
-				found = true
-				break
-			}
-		}
+	found := false
 
-		if !found {
-			return nil
+	for _, br := range envType.GitDeployBranches {
+		if br == branch {
+			found = true
+			break
 		}
 	}
 
+	if !found {
+		return nil
+	}
+
 	client, err := getGithubClientFromEnvironment(c.Config(), env)
 
 	if err != nil {

+ 1 - 1
cli/cmd/apply.go

@@ -368,7 +368,7 @@ func (d *DeployDriver) applyApplication(resource *switchboardModels.Resource, cl
 
 	if tag == "" {
 		color.New(color.FgYellow).Printf("for resource %s, since PORTER_TAG is not set, the Docker image tag will default to"+
-			" the git repo SHA", resourceName)
+			" the git repo SHA\n", resourceName)
 
 		commit, err := git.LastCommit()