Add sha256 and file count to pages_deployments
What does this MR do?
Related to #267495 (closed) and #266878 (closed)
- We want to use sha256 as cache key in gitlab pages and it may be useful later.
- We also want to have a number of individual entries in the archive - later we want to introduce some kind of limit for it, but first we need to collect some statistics
This MR adds both these fields and sets them during deployment. Since the feature flag was never enabled(and I assume no one but me enabled it locally), we can just remove existing pages_deployments and add fields with not null.
Note that file_sha256
is null: false
, but the same field for ci_job_artifacts
isn't. All new artifacts will have this field set and we only use new artifacts, so we can safely use it and raise an error if it's absent(which will never happen).
Migrations
vlad @ gdk1 ➜ gitlab git:(267495-add-sha256-of-pages-contents-to-pages_deployments) ✗ ./bin/rails db:migrate
== 20201019111952 AddSha256AndFilecountToPagesDeployments: migrating ==========
-- execute("DELETE FROM pages_deployments")
-> 0.0032s
-- add_column(:pages_deployments, :file_count, :integer, {:null=>false})
-> 0.0025s
-- add_column(:pages_deployments, :file_sha256, :binary, {:null=>false})
-> 0.0012s
== 20201019111952 AddSha256AndFilecountToPagesDeployments: migrated (0.0073s) =
vlad @ gdk1 ➜ gitlab git:(267495-add-sha256-of-pages-contents-to-pages_deployments) ✗ ./bin/rails db:rollback
== 20201019111952 AddSha256AndFilecountToPagesDeployments: reverting ==========
-- remove_column(:pages_deployments, :file_sha256, :bytea, {:null=>false})
-> 0.0038s
-- remove_column(:pages_deployments, :file_count, :integer, {:null=>false})
-> 0.0007s
== 20201019111952 AddSha256AndFilecountToPagesDeployments: reverted (0.0102s) =
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Adam Hegyi