Restarting auto-stopped Environments does not work (intermittent)

Summary

When starting a deployment (start_review_app) after the environment is auto-stopped, the environment doesn't restart.

This means the deployment doesn't show up in the environments tab - and the deployment isn't auto-stopped after the expected time.

Steps to reproduce

  1. create a new project
  2. Add a CI job that deploys to an environment
  3. wait for pipeline to finish
  4. go to environments
  5. press stop button
  6. wait for stop action to finish
  7. re-run the pipeline and wait for it's completion
  8. visit the environments page, the environment won't be active

Example Project

What is the current bug behavior?

After redeployment stopped environments still shows as stopped, instead of re-starting.

What is the expected correct behavior?

Stopped environments should always re-start. Either through re-deployment or manually restarting

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes