Skip to content

Add migration to create self monitoring project environment

Kirstie Cook requested to merge 204858-update-self-monitor-environments into master

What does this MR do?

We recently added a metrics dashboard for the Self Monitoring Project, and this requires the presence of an Environment to load the dashboard. We already have adjusted the process of creating the Self Monitoring Project to also create an environment in !24403 (merged), but that does not address any existing Self Monitoring Projects. This MR searches for the presence of a Self Monitoring Project and creates the environment for it, provided one does not already exist.

Migration Output

Up:

== 20200214214934 CreateEnvironmentForSelfMonitoringProject: migrating ========
-- execute("INSERT INTO environments (project_id, name, slug, created_at, updated_at)\nSELECT instance_administration_project_id, 'production', 'production', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP\nFROM application_settings\nWHERE instance_administration_project_id IS NOT NULL\nAND NOT EXISTS (\n  SELECT 1\n  FROM environments\n  INNER JOIN application_settings\n  ON application_settings.instance_administration_project_id = environments.project_id\n)\n")
   -> 0.0056s
== 20200214214934 CreateEnvironmentForSelfMonitoringProject: migrated (0.0057s)

Down:

== 20200214214934 CreateEnvironmentForSelfMonitoringProject: reverting ========
== 20200214214934 CreateEnvironmentForSelfMonitoringProject: reverted (0.0000s)

Screenshots

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

Closes #204858 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports