Ver Fonte

workflow and domain fixes (#3840)

ianedwards há 2 anos atrás
pai
commit
c1facad19f

+ 7 - 5
api/server/handlers/porter_app/apply.go

@@ -229,13 +229,11 @@ func addPorterSubdomainsIfNecessary(ctx context.Context, app v2.PorterApp, deplo
 	ctx, span := telemetry.NewSpan(ctx, "add-porter-subdomains-if-necessary")
 	defer span.End()
 
+	services := make([]v2.Service, 0)
+
 	for _, service := range app.Services {
 		if service.Type == v2.ServiceType_Web {
-			if service.Private == nil || !*service.Private {
-				continue
-			}
-
-			if service.Domains != nil && len(service.Domains) == 0 {
+			if service.Private != nil && !*service.Private && service.Domains != nil && len(service.Domains) == 0 {
 				if deploymentTarget.Namespace != DeploymentTargetSelector_Default {
 					createSubdomainInput.AppName = fmt.Sprintf("%s-%s", createSubdomainInput.AppName, deploymentTarget.ID[:6])
 				}
@@ -254,7 +252,11 @@ func addPorterSubdomainsIfNecessary(ctx context.Context, app v2.PorterApp, deplo
 				}
 			}
 		}
+
+		services = append(services, service)
 	}
 
+	app.Services = services
+
 	return app, nil
 }

+ 12 - 3
dashboard/src/main/home/app-dashboard/new-app-flow/GithubActionModal.tsx

@@ -59,6 +59,7 @@ const GithubActionModal: React.FC<Props> = ({
         projectId,
         clusterId,
         stackName,
+        branch,
         porterYamlPath
       );
     }
@@ -72,6 +73,14 @@ const GithubActionModal: React.FC<Props> = ({
     );
   }, [type]);
 
+  const headingText = useMemo(() => {
+    if (type === "preview") {
+      return `./github/workflows/porter_preview_${stackName}.yml`;
+    }
+
+    return `./github/workflows/porter_stack_${stackName}.yml`;
+  }, [type, stackName]);
+
   const submit = async () => {
     if (
       githubAppInstallationID &&
@@ -141,7 +150,7 @@ const GithubActionModal: React.FC<Props> = ({
         noWrapper
         expandText="[+] Show code"
         collapseText="[-] Hide code"
-        Header={<ModalHeader>.github/workflows/porter.yml</ModalHeader>}
+        Header={<ModalHeader>{headingText}</ModalHeader>}
         isInitiallyExpanded
         spaced
         copy={actionYamlContents}
@@ -226,8 +235,8 @@ const GithubActionModal: React.FC<Props> = ({
 export default withRouter(GithubActionModal);
 
 const ModalHeader = styled.div`
-  font-weight: 600;
-  font-size: 16px;
+  font-weight: 500;
+  font-size: 14px;
   font-family: monospace;
   height: 40px;
   display: flex;

+ 4 - 4
dashboard/src/main/home/app-dashboard/new-app-flow/utils.ts

@@ -60,16 +60,16 @@ export const getPreviewGithubAction = (
   branchName: string,
   porterYamlPath: string = "porter.yaml"
 ) => {
-  return `on:
+  return `"on":
   pull_request:
-    paths:
-    - *
-    - '!./github/workflows/porter-**'
     branches:
     - ${branchName}
     types:
     - opened
     - synchronize
+    paths:
+    - '**'
+    - '!./github/workflows/porter-**'
     
 name: Deploy to Preview Environment
 jobs:

+ 1 - 1
internal/integrations/ci/actions/stack.go

@@ -194,8 +194,8 @@ func getStackApplyActionYAML(opts *GetStackApplyActionYAMLOpts) ([]byte, error)
 			On: GithubActionYAMLOnPullRequest{
 				PullRequest: GithubActionYAMLOnPullRequestTypes{
 					Paths: []string{
-						"*",
 						"!./github/workflows/porter-**",
+						"**",
 					},
 					Branches: []string{
 						opts.DefaultBranch,