Skip to content

Add seed for license file

David Fernandez requested to merge 10io-seed-license-file into master

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

Without GITLAB_LICENSE_FILE set

$ 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

With a valid GITLAB_LICENSE_FILE set

$ 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

With an invalid GITLAB_LICENSE_FILE set

$ 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

Availability and Testing

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

Merge request reports