Kaynağa Gözat

remove concept of custom namespace for a preview env on our side

Mohammed Nafees 3 yıl önce
ebeveyn
işleme
c4ea785c72

+ 0 - 1
api/server/handlers/environment/create.go

@@ -189,7 +189,6 @@ func (c *CreateEnvironmentHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ
 		GitInstallationID: uint(ga.InstallationID),
 		EnvironmentName:   request.Name,
 		InstanceName:      c.Config().ServerConf.InstanceName,
-		CustomNamespace:   request.CustomNamespace,
 	})
 
 	if err != nil {

+ 0 - 1
api/types/environment.go

@@ -21,7 +21,6 @@ type Environment struct {
 type CreateEnvironmentRequest struct {
 	Name                 string            `json:"name" form:"required"`
 	Mode                 string            `json:"mode" form:"oneof=auto manual" default:"manual"`
-	CustomNamespace      bool              `json:"custom_namespaces"`
 	NamespaceAnnotations map[string]string `json:"namespace_annotations"`
 }
 

+ 0 - 5
cli/cmd/apply.go

@@ -757,11 +757,6 @@ func NewDeploymentHook(client *api.Client, resourceGroup *switchboardTypes.Resou
 func (t *DeploymentHook) PreApply() error {
 	if isSystemNamespace(t.namespace) {
 		color.New(color.FgYellow).Printf("attempting to deploy to system namespace '%s'\n", t.namespace)
-	} else if t.namespace == "SET_CUSTOM_NAMESPACE_HERE" {
-		// user wanted to use custom namespaces but forgot to update the workflow file
-		return fmt.Errorf("you need to replace 'SET_CUSTOM_NAMESPACE_HERE' with a custom namespace of your choice in "+
-			"the workflow file: https://github.com/%s/%s/blob/%s/.github/workflows/porter_preview_env.yml",
-			t.repoOwner, t.repoName, t.branchFrom)
 	}
 
 	envList, err := t.client.ListEnvironments(

+ 0 - 2
internal/integrations/ci/actions/preview.go

@@ -19,7 +19,6 @@ type EnvOpts struct {
 	EnvironmentName                         string
 	InstanceName                            string
 	ProjectID, ClusterID, GitInstallationID uint
-	CustomNamespace                         bool
 }
 
 func SetupEnv(opts *EnvOpts) error {
@@ -233,7 +232,6 @@ func getPreviewApplyActionYAML(opts *EnvOpts) ([]byte, error) {
 			opts.GitRepoOwner,
 			opts.GitRepoName,
 			"v0.2.1",
-			opts.CustomNamespace,
 		),
 	}
 

+ 1 - 8
internal/integrations/ci/actions/steps.go

@@ -44,9 +44,8 @@ func getCreatePreviewEnvStep(
 	serverURL, porterTokenSecretName string,
 	projectID, clusterID, gitInstallationID uint,
 	repoOwner, repoName, actionVersion string,
-	customNamespace bool,
 ) GithubActionYAMLStep {
-	step := GithubActionYAMLStep{
+	return GithubActionYAMLStep{
 		Name: "Create Porter preview env",
 		Uses: fmt.Sprintf("%s@%s", createPreviewActionName, actionVersion),
 		With: map[string]string{
@@ -67,10 +66,4 @@ func getCreatePreviewEnvStep(
 		},
 		Timeout: 30,
 	}
-
-	if customNamespace {
-		step.With["namespace"] = "SET_CUSTOM_NAMESPACE_HERE"
-	}
-
-	return step
 }