Add seed for license file
What does this MR do?
After uploading a gitlab license file through the UI after $ rails setup
for like the millionth time, I decided to do something.
This MR does the following:
- adds a rake task that can load a License file from the
GITLAB_LICENSE_FILE
flag. - The task has two modes: verbose or not. Verbose meaning that if the
GITLAB_LICENSE_FILE
flag is not set, a help message is displayed. - If the
GITLAB_LICENSE_FILE
flag is set to a wrong path, an error is raised. - Update production fixture
010_license_file.rb
to use the above rake task. - Adds a dev fixture
10_license_file.rb
using the above rake task in verbose mode.
Screenshots
GITLAB_LICENSE_FILE
set
Without $ rails setup
[ output truncated ]
== Seed from ee/db/fixtures/development/10_license_file.rb
Skipped. Use the `GITLAB_LICENSE_FILE` environment variable to seed the License file of the given path.
OK
GITLAB_LICENSE_FILE
set
With a valid $ GITLAB_LICENSE_FILE=gitlab/license/file/path rails setup
[ output truncated ]
== Seed from ee/db/fixtures/development/10_license_file.rb
License Added:
FilePath: gitlab/license/file/path
OK
GITLAB_LICENSE_FILE
set
With an invalid $ GITLAB_LICENSE_FILE=invalid/gitlab/license/file/path rails setup
[ output truncated ]
== Seed from ee/db/fixtures/development/10_license_file.rb
License File Missing:
FilePath: invalid/gitlab/license/file/path
rails aborted!
License File Missing
[ backtrace ]
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
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 David Fernandez