From bdd55889500ffc44e5b0c0cfd7d305d7ffc367de Mon Sep 17 00:00:00 2001 From: Vishal Tak Date: Tue, 16 Sep 2025 11:46:11 +0530 Subject: [PATCH] Change workspaces agent config dns_zone default to empty string Changelog: changed --- ...ange_workspaces_agent_config_dns_zone_default.rb | 13 +++++++++++++ db/schema_migrations/20250917093907 | 1 + db/structure.sql | 2 +- .../remote_development/workspaces_agent_config.rb | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 db/post_migrate/20250917093907_change_workspaces_agent_config_dns_zone_default.rb create mode 100644 db/schema_migrations/20250917093907 diff --git a/db/post_migrate/20250917093907_change_workspaces_agent_config_dns_zone_default.rb b/db/post_migrate/20250917093907_change_workspaces_agent_config_dns_zone_default.rb new file mode 100644 index 00000000000000..135627feb0e2a7 --- /dev/null +++ b/db/post_migrate/20250917093907_change_workspaces_agent_config_dns_zone_default.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class ChangeWorkspacesAgentConfigDnsZoneDefault < Gitlab::Database::Migration[2.3] + milestone '18.5' + + def up + change_column_default :workspaces_agent_configs, :dns_zone, from: nil, to: "" + end + + def down + change_column_default :workspaces_agent_configs, :dns_zone, from: "", to: nil + end +end diff --git a/db/schema_migrations/20250917093907 b/db/schema_migrations/20250917093907 new file mode 100644 index 00000000000000..57df1b4d13a391 --- /dev/null +++ b/db/schema_migrations/20250917093907 @@ -0,0 +1 @@ +541cb32972b3a51fb9c4ee2f4f62aaae06203b023abb91a35e03408f234ec198 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 213cfc5bb853bd..2183ba790bb956 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -27626,7 +27626,7 @@ CREATE TABLE workspaces_agent_configs ( project_id bigint NOT NULL, enabled boolean NOT NULL, network_policy_enabled boolean DEFAULT true NOT NULL, - dns_zone text NOT NULL, + dns_zone text DEFAULT ''::text NOT NULL, gitlab_workspaces_proxy_namespace text DEFAULT 'gitlab-workspaces'::text NOT NULL, network_policy_egress jsonb DEFAULT '[{"allow": "0.0.0.0/0", "except": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]}]'::jsonb NOT NULL, default_resources_per_workspace_container jsonb DEFAULT '{}'::jsonb NOT NULL, diff --git a/ee/app/models/remote_development/workspaces_agent_config.rb b/ee/app/models/remote_development/workspaces_agent_config.rb index 908e45dd1dd7df..8f5fd5a559cb89 100644 --- a/ee/app/models/remote_development/workspaces_agent_config.rb +++ b/ee/app/models/remote_development/workspaces_agent_config.rb @@ -6,6 +6,9 @@ class WorkspacesAgentConfig < ApplicationRecord # https://gitlab.com/gitlab-org/gitlab/-/issues/410045#note_1385602915 include Sortable + include SafelyChangeColumnDefault + + columns_changing_default :dns_zone UNLIMITED_QUOTA = -1 MIN_HOURS_BEFORE_TERMINATION = 1 -- GitLab