Skip to content

Edge case: Existing deployments do not belong to any environments.

Problem

We encountered a problem that there were 2 deployments rows did not belong to any environments.

For example, this entry fell into that situation.

#<Deployment id: 9191109,
 iid: 35840,
 project_id: 13083,
 environment_id: 498219,
 ref: "xxxxxxx",
 tag: false,
 sha: "f17347b2ee8e4f80deb17aaae10f1a298f8ac7a4",
 user_id: 895869,
 deployable_id: 147364491,
 deployable_type: "CommitStatus",
 created_at: "2019-01-17 17:23:25",
 updated_at: "2019-01-17 17:23:25",
 on_stop: "review-stop",
 finished_at: "2019-01-18 09:49:48",
 status: "running">

The corresponding environment did not exist.

gitlabhq_production=> select * from environments where id = 498219;
 id | project_id | name | created_at | updated_at | external_url | environment_type | state | slug 
----+------------+------+------------+------------+--------------+------------------+-------+------
(0 rows)

See more https://gitlab.com/gitlab-org/gitlab-ce/issues/56518#note_132679541

Edited by Shinya Maeda