From b4a491a539d2aad0f36162a7cb335176d38c7650 Mon Sep 17 00:00:00 2001 From: lubien Date: Tue, 18 Nov 2025 13:54:30 -0300 Subject: [PATCH 1/3] Upgrade mise version to v2025.11.6 --- deployer.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployer.Dockerfile b/deployer.Dockerfile index dafc4ddcfb..b8c125c996 100644 --- a/deployer.Dockerfile +++ b/deployer.Dockerfile @@ -30,7 +30,7 @@ ENV DEFAULT_RUBY_VERSION=3.1.6 \ ARG NODE_BUILD_VERSION=5.3.8 # install mise -RUN curl https://mise.run | MISE_VERSION=v2024.8.6 sh && \ +RUN curl https://mise.run | MISE_VERSION=v2025.11.6 sh && \ echo -e "\n\nexport PATH=\"$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH\"" >> ~/.bash_profile ENV MISE_PYTHON_COMPILE=false From 18538f8a60f091f0055cc0ca363c31e2c151205b Mon Sep 17 00:00:00 2001 From: lubien Date: Tue, 18 Nov 2025 13:54:53 -0300 Subject: [PATCH 2/3] Add error handling to NewMPGService and related functions --- internal/command/launch/plan_commands.go | 2 +- internal/command/mpg/mpg.go | 30 +++++++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/internal/command/launch/plan_commands.go b/internal/command/launch/plan_commands.go index b1bfb7ced7..434dff0a84 100644 --- a/internal/command/launch/plan_commands.go +++ b/internal/command/launch/plan_commands.go @@ -206,7 +206,7 @@ func RunPlan(ctx context.Context, step string) error { func runPropose(ctx context.Context) error { if flag.GetString(ctx, "manifest-path") == "" { - ctx = logger.NewContext(context.Background(), logger.New(os.Stderr, logger.FromContext(ctx).Level(), iostreams.IsTerminalWriter(os.Stdout))) + ctx = logger.NewContext(ctx, logger.New(os.Stderr, logger.FromContext(ctx).Level(), iostreams.IsTerminalWriter(os.Stdout))) } RunPlan(ctx, "propose") diff --git a/internal/command/mpg/mpg.go b/internal/command/mpg/mpg.go index 9beac7133b..e5690b0877 100644 --- a/internal/command/mpg/mpg.go +++ b/internal/command/mpg/mpg.go @@ -40,11 +40,15 @@ type MPGService struct { } // NewMPGService creates a new MPGService with default dependencies -func NewMPGService(ctx context.Context) *MPGService { +func NewMPGService(ctx context.Context) (*MPGService, error) { + uiexClient := uiexutil.ClientFromContext(ctx) + if uiexClient == nil { + return nil, fmt.Errorf("uiex client not found in context") + } return &MPGService{ - uiexClient: uiexutil.ClientFromContext(ctx), + uiexClient: uiexClient, regionProvider: &DefaultRegionProvider{}, - } + }, nil } // NewMPGServiceWithDependencies creates a new MPGService with custom dependencies @@ -122,7 +126,10 @@ func ClusterFromFlagOrSelect(ctx context.Context, orgSlug string) (*uiex.Managed // GetAvailableMPGRegions returns the list of regions available for Managed Postgres func GetAvailableMPGRegions(ctx context.Context, orgSlug string) ([]fly.Region, error) { - service := NewMPGService(ctx) + service, err := NewMPGService(ctx) + if err != nil { + return nil, err + } return service.GetAvailableMPGRegions(ctx, orgSlug) } @@ -134,6 +141,11 @@ func (s *MPGService) GetAvailableMPGRegions(ctx context.Context, orgSlug string) return nil, err } + // Check if uiexClient is initialized + if s.uiexClient == nil { + return nil, fmt.Errorf("uiex client is not initialized") + } + // Try to get available MPG regions from API mpgRegionsResponse, err := s.uiexClient.ListMPGRegions(ctx, orgSlug) if err != nil { @@ -145,7 +157,10 @@ func (s *MPGService) GetAvailableMPGRegions(ctx context.Context, orgSlug string) // IsValidMPGRegion checks if a region code is valid for Managed Postgres func IsValidMPGRegion(ctx context.Context, orgSlug string, regionCode string) (bool, error) { - service := NewMPGService(ctx) + service, err := NewMPGService(ctx) + if err != nil { + return false, err + } return service.IsValidMPGRegion(ctx, orgSlug, regionCode) } @@ -166,7 +181,10 @@ func (s *MPGService) IsValidMPGRegion(ctx context.Context, orgSlug string, regio // GetAvailableMPGRegionCodes returns just the region codes for error messages func GetAvailableMPGRegionCodes(ctx context.Context, orgSlug string) ([]string, error) { - service := NewMPGService(ctx) + service, err := NewMPGService(ctx) + if err != nil { + return nil, err + } return service.GetAvailableMPGRegionCodes(ctx, orgSlug) } From 05ae2daca95042897a5c038eb313876f8b558f06 Mon Sep 17 00:00:00 2001 From: lubien Date: Tue, 18 Nov 2025 13:55:37 -0300 Subject: [PATCH 3/3] Add trigger configuration to Django basic deployment test --- test/deployer/deployer_test.go | 11 +++++++++++ test/fixtures/django-basic/fly.toml | 13 +++++++++++++ test/testlib/deployer.go | 11 +++++++++++ 3 files changed, 35 insertions(+) create mode 100644 test/fixtures/django-basic/fly.toml diff --git a/test/deployer/deployer_test.go b/test/deployer/deployer_test.go index f90420989c..225b73188e 100644 --- a/test/deployer/deployer_test.go +++ b/test/deployer/deployer_test.go @@ -300,7 +300,18 @@ func TestLaunchRails8(t *testing.T) { func TestLaunchDjangoBasic(t *testing.T) { deploy := testDeployer(t, withFixtureApp("django-basic"), + withOverwrittenConfig(func(d *testlib.DeployTestRun) map[string]any { + return map[string]any{ + "app": "dummy-app-name", + "region": d.PrimaryRegion(), + "env": map[string]string{ + "TEST_ID": d.ID(), + }, + } + }), createRandomApp, + testlib.WithTrigger("launch"), + testlib.WithCopyConfig, testlib.WithoutCustomize, testlib.WithouExtensions, testlib.DeployNow, diff --git a/test/fixtures/django-basic/fly.toml b/test/fixtures/django-basic/fly.toml new file mode 100644 index 0000000000..de66159475 --- /dev/null +++ b/test/fixtures/django-basic/fly.toml @@ -0,0 +1,13 @@ +app = "{{apps.0}}" +primary_region = '{{region}}' + +[deploy] + release_command = "sleep 2" + +[env] + TEST_ID = "{{test.id}}" + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 diff --git a/test/testlib/deployer.go b/test/testlib/deployer.go index 04637e85fa..0d44d2c627 100644 --- a/test/testlib/deployer.go +++ b/test/testlib/deployer.go @@ -91,6 +91,8 @@ type DeployTestRun struct { region string + trigger string + noCustomize bool skipExtensions bool copyConfig bool @@ -175,6 +177,12 @@ func WithCopyConfig(d *DeployTestRun) { d.copyConfig = true } +func WithTrigger(trigger string) func(*DeployTestRun) { + return func(d *DeployTestRun) { + d.trigger = trigger + } +} + func OptOutGithubActions(d *DeployTestRun) { d.optOutGha = true } @@ -230,6 +238,9 @@ func (d *DeployTestRun) Start(ctx context.Context) error { if d.copyConfig { env = append(env, "DEPLOY_COPY_CONFIG=1") } + if d.trigger != "" { + env = append(env, fmt.Sprintf("DEPLOY_TRIGGER=%s", d.trigger)) + } if d.optOutGha { env = append(env, "OPT_OUT_GITHUB_ACTIONS=1") }