Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 49,670
    • Issues 49,670
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,561
    • Merge requests 1,561
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #24295
Closed
Open
Issue created Sep 21, 2018 by John Jarvis@jarvDeveloper

Set a deploy freeze in the UI

Problem to Solve

It would be useful for gitlab.com full CD deployments to be able to specify windows of time when runners are paused for an environment. This has different use cases, for example:

For a regularly scheduled cron like syntax For ad-hoc windows
- For teams that are not global, the ability to halt CICD deployments off-hours.
- Suspend CICD pipelines on weekends when there is limited team availability.
- Special events such as big announcements, livestreams, etc.
- Holidays where there is limited team availability.

Intended users

Persona: DevOps Engineer

Proposal

  • Store freeze periods in GitLab's database, and reference them from .gitlab-ci.yml.
  • Deployment freeze periods will be specified in the GitLab UI on a project level, using cron syntax in a new settings section.
  • We will implement this feature using rules. See the Example section below for an example of this syntax in .gitlab-ci.yml.
  • As shown in the example section below, this feature will be an opt-in: deploy freezes will not be respected until .gitlab-ci.yml is edited to make the deployment jobs aware of deploy freezes.
  • We will modify the pipeline to Skip a pipeline found inside the deploy freeze. It will need to be manually restarted once the freeze is over. We will tackle a restart mechanist later on. #211518
    • Needs investigation: Potentially pivot off resource groups, which gives us restartable jobs after freeze period by default.

UX Proposal

⭐ SEE PROTOTYPES ON THE DESIGN TAB ⭐

User story

As a DevOps Engineer/Release Manager, I want to specify windows of time when deployments are not allowed for an environment with my GitLab project, so that I can interlock it within CI/CD and automation.

  • On project settings > ci/cd, a new expandable section should be added for Deploy Freezes. A helper text should link to the documentation page.
  • Users should have an option to expand/collapse the area. Clicking on "expand" shows the form fields to set a deploy freeze.
  • Once the section is expanded, the user will see an action button and either:
    • An empty state message within a table component, if no deploy freezes are specified, or
    • A list with specified deploy freezes.
  • Clicking the Add deployment freeze button should trigger a modal (frontend modal size: small) with options to set:
    • Cron attributes (frontend component: form-input)
      • User should be able to input only CRON attributes (https://crontab.guru/)
      • Requires front-end validation. If the data is invalid, an the input shows an error state.
      • The primary button is disabled until all fields are entered.
      • If the data is invalid, the button to Add deployment freeze should stay disabled. User should not be able to click it until validation succeeds.
    • Timezone (frontend component: dropdown-search with header)
      • For now, we will only support the freeze to be specified on the same time zone.
  • Clicking the Cancel button should close the modal. No information is stored or updated.
  • Clicking the Add deploy freeze button should close the modal and the information about the deployment freeze should be displayed on the page on a table (start, end, time zone).

Examples

Technical Example

Below is an example of a deploy freeze that ensure no production deployments are executed over 23h on christmas eve until 23h on boxing day:

  1. Defining the freeze window in the UI (see example)

  2. Making the production deployment job respect the deploy freeze in .gitlab-ci.yml:

    deploy_to_production:
      stage: deploy
      script: deploy_to_prod.sh
      rules:
        - if: $CI_ENVIRONMENT_FROZEN == null

Further details

  • MVC will allow multiple freeze periods to be specified; one period per project is too limiting.
  • UI will be built with Vue.
  • Freeze periods are UNIONed with each other.
  • Specifying a timezone for each entry is a bit repetitive, but is necessary for now. A future iteration might extract this dropdown to a higher level.

Out of scope

The following features are considered out of scope for the purposes of this MVC but may be considered as future enhancements:

  • Group-level freezes
  • Notifications and UI alerts
  • Restartable jobs, if we don't get this for free by reusing resource groups
  • Ability to specify deploy freezes using calendar dates/time pickers (as opposed to cron syntax)
  • Human-readable cron syntax descriptions (i.e. "At 07:00 on Monday")
  • Freeze period "groups" which would allow multiple freeze schedules to be defined and referenced by name in .gitlab-ci.yml

Documentation

Yes, this will require a new documentation page.

Link to new page: https://docs.gitlab.com/ee/user/project/releases/#set-a-deploy-freeze

Edited Apr 15, 2020 by Rayana Verissimo
Assignee
Assign to
Time tracking