Коммит 58befc5d создал по автору janis's avatar janis
Просмотр файлов

Add a "root_directory" to the pages deployment

This is used to dynamically set the root dir value per deployment and is exposed via API for Pages to use

Changelog: added
владелец 3a902f0c
......@@ -61,6 +61,13 @@ def unique_url
end
strong_memoize_attr :unique_url
def root_directory
return unless deployment
deployment.root_directory
end
strong_memoize_attr :root_directory
private
attr_reader :project, :trim_prefix, :domain
......
......@@ -90,7 +90,8 @@ def create_pages_deployment(artifacts_path, build)
file: file,
file_count: deployment_update.entries_count,
file_sha256: sha256,
ci_build_id: build.id
ci_build_id: build.id,
root_directory: build.options[:publish]
)
break if deployment.size != file.size || deployment.file.size != file.size
......
# frozen_string_literal: true
class AddRootDirectoryToPagesDeployment < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
add_column :pages_deployments, :root_directory, :text, default: "public"
add_text_limit :pages_deployments, :root_directory, 255
end
def down
remove_column :pages_deployments, :root_directory, if_exists: true
end
end
cdab77e32a35bc1e2b7cbc91fd3df286b2651db0a123f904d35292a2ab80371d
\ Нет новой строки в конце файла
......@@ -11738,10 +11738,10 @@ CREATE TABLE application_settings (
security_policy_global_group_approvers_enabled boolean DEFAULT true NOT NULL,
projects_api_rate_limit_unauthenticated integer DEFAULT 400 NOT NULL,
deny_all_requests_except_allowed boolean DEFAULT false NOT NULL,
product_analytics_data_collector_host text,
lock_memberships_to_saml boolean DEFAULT false NOT NULL,
gitlab_dedicated_instance boolean DEFAULT false NOT NULL,
product_analytics_data_collector_host text,
update_runner_versions_enabled boolean DEFAULT true NOT NULL,
gitlab_dedicated_instance boolean DEFAULT false NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)),
CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
......@@ -19774,7 +19774,9 @@ CREATE TABLE pages_deployments (
file_count integer NOT NULL,
file_sha256 bytea NOT NULL,
size bigint,
root_directory text DEFAULT 'public'::text,
CONSTRAINT check_5f9132a958 CHECK ((size IS NOT NULL)),
CONSTRAINT check_7e938c810a CHECK ((char_length(root_directory) <= 255)),
CONSTRAINT check_f0fe8032dd CHECK ((char_length(file) <= 255))
);
 
......@@ -30929,6 +30931,8 @@ CREATE UNIQUE INDEX index_merge_request_reviewers_on_merge_request_id_and_user_i
 
CREATE INDEX index_merge_request_reviewers_on_user_id ON merge_request_reviewers USING btree (user_id);
 
CREATE UNIQUE INDEX index_merge_request_user_mentions_note_id_convert_to_bigint ON merge_request_user_mentions USING btree (note_id_convert_to_bigint) WHERE (note_id_convert_to_bigint IS NOT NULL);
CREATE UNIQUE INDEX index_merge_request_user_mentions_on_note_id ON merge_request_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);
 
CREATE INDEX index_merge_requests_closing_issues_on_issue_id ON merge_requests_closing_issues USING btree (issue_id);
......@@ -35109,6 +35113,9 @@ ALTER TABLE ONLY issues
ALTER TABLE ONLY geo_event_log
ADD CONSTRAINT fk_geo_event_log_on_geo_event_id FOREIGN KEY (geo_event_id) REFERENCES geo_events(id) ON DELETE CASCADE;
 
ALTER TABLE ONLY merge_request_user_mentions
ADD CONSTRAINT fk_merge_request_user_mentions_note_id_convert_to_bigint FOREIGN KEY (note_id_convert_to_bigint) REFERENCES notes(id) ON DELETE CASCADE NOT VALID;
ALTER TABLE ONLY path_locks
ADD CONSTRAINT fk_path_locks_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
 
......@@ -10,7 +10,8 @@ class LookupPath < Grape::Entity
:prefix,
:project_id,
:source,
:unique_url
:unique_url,
:root_directory
end
end
end
......
......@@ -8,23 +8,62 @@
"prefix"
],
"properties": {
"project_id": { "type": "integer" },
"https_only": { "type": "boolean" },
"access_control": { "type": "boolean" },
"source": { "type": "object",
"required": ["type", "path"],
"properties" : {
"type": { "type": "string", "enum": ["file", "zip"] },
"path": { "type": "string" },
"global_id": { "type": "string" },
"sha256": { "type": "string" },
"file_size": { "type": "integer" },
"file_count": { "type": ["integer", "null"] }
"project_id": {
"type": "integer"
},
"https_only": {
"type": "boolean"
},
"access_control": {
"type": "boolean"
},
"source": {
"type": "object",
"required": [
"type",
"path"
],
"properties": {
"type": {
"type": "string",
"enum": [
"file",
"zip"
]
},
"path": {
"type": "string"
},
"global_id": {
"type": "string"
},
"sha256": {
"type": "string"
},
"file_size": {
"type": "integer"
},
"file_count": {
"type": [
"integer",
"null"
]
}
},
"additionalProperties": false
},
"prefix": { "type": "string" },
"unique_url": { "type": ["string", "null"] }
"prefix": {
"type": "string"
},
"unique_url": {
"type": [
"string",
"null"
]
},
"root_directory": {
"type": "string"
}
},
"additionalProperties": false
}
......@@ -117,7 +117,8 @@
'file_size' => deployment.size,
'file_count' => deployment.file_count
},
'unique_url' => nil
'unique_url' => nil,
'root_directory' => deployment.root_directory
}
]
)
......@@ -206,7 +207,8 @@
'file_size' => deployment.size,
'file_count' => deployment.file_count
},
'unique_url' => 'http://unique-domain.example.com'
'unique_url' => 'http://unique-domain.example.com',
'root_directory' => deployment.root_directory
}
]
)
......@@ -262,7 +264,8 @@
'file_size' => deployment.size,
'file_count' => deployment.file_count
},
'unique_url' => nil
'unique_url' => nil,
'root_directory' => deployment.root_directory
}
]
)
......@@ -310,7 +313,8 @@
'file_size' => deployment.size,
'file_count' => deployment.file_count
},
'unique_url' => nil
'unique_url' => nil,
'root_directory' => deployment.root_directory
}
]
)
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать