Skip to content

Persist and control auto stop date for environments

What does this MR do?

This MR introduces a groud work for #20956 (closed), specifically,

  • It allows to define environment:auto_stop_in keyword in .gitlab-ci.yml.
  • It persists the parsed value in database.
  • We expose cancel_auto_stop endpoint to nullify the persisted value.
  • Fixes update_environment permission check as it should be allowed for Developer role.

You can also find PoC !18115 (closed). It's already been reviewed by PM and UX.

Related: #20956 (closed)

TODO

  • Fill Description
  • Use ci_builds_metadata instead of ci_builds.options
  • app/models/ci/build.rb
  • app/models/environment.rb
  • lib/gitlab/ci/config/entry/environment.rb
  • lib/gitlab/ci/pipeline/seed/environment.rb
  • lib/gitlab/ci/yaml_processor.rb
  • app/serializers/environment_entity.rb
  • app/services/deployments/after_create_service.rb
  • app/services/environments/reset_auto_stop_service.rb
  • app/controllers/projects/environments_controller.rb

Feature Flag

This feature is built behind auto_stop_environments feature flag and disabled by default until we make sure it's deemed stable.

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
Edited by Shinya Maeda

Merge request reports