Environment Reservations

6 minute read

Environment Reservation equips the operations team with capabilities that allow it to impart control on environments or environment tiers, making application deployments more reliable and predictable.

Every environment has an enable or disable flag that you can leverage to control the deployment, acting as an ON/OFF switch for the environment. Once enabled, an environment is open for deployments 24 hours a day. An additional option called Reservation Required can be used to restrict deployments on enabled environments. Deployment to environments that require reservation are permitted only if the application, pipeline, or release has a valid reservation. This is a good way to control deployments to controlled environments, such as production environments.

There are two main types of environment reservations:

  • Blackouts

    These are times during which all deployments are prohibited to the environment. They are useful when an environment needs to be brought down for system upgrades or maintenance tasks or to reflect restricted time periods based on business needs such as trading windows for financial institutions.

  • Environment reservations for applications, pipelines, and releases

    Environment reservations can be exclusive or nonexclusive.

    Exclusive reservations are useful when you want to control deployment conflicts. Only one application, pipeline, or release can have an exclusive reservation on an environment at any time. This helps to avoid conflicts due to double booking. Exclusive reservations can be set by not allowing overlap.

    Nonexclusive reservations are useful when it is acceptable for reservations to overlap at the same time.

Environment reservation rules are only validated and enforced at the beginning of application deployments. If you try to run an application when the reservation exists in the future, the job will wait for the reservation window to open before it is executed. This will relieve you of having to wait for the reservation period to open before the application is deployed.

This is a summary of the business rules for environment reservations that are validated when you try to run an application.

  • Check whether the environment is ENABLED.

    If TRUE, continue.

  • Check whether the deployment falls within a BLACKOUT period.

    If TRUE, the job will wait until the blackout period is over (given that the maximum job wait time is not exceeded).

  • An environment reservation is not required.

    Look for EXCLUSIVE reservations. Check whether a RESERVATION exists for a different application. * If TRUE, the job will not run. Check whether a future RESERVATION exists for the application. * If TRUE, the job will wait till the reservation time. Check whether an ACTIVE RESERVATION exists for the application or if no other application has an EXCLUSIVE reservation. * If TRUE, start the deployment.

  • An environment reservation is required.

    • Check for an application reservation.

      • If TRUE :

        • If the reservation is currently active, the deployment starts.

        • If the reservation is in the future, CloudBees Flow waits for the reservation period to open.

      • If FALSE :

        • The job will not run.

In a pipeline, execution starts immediately. However, when an application deployment task begins, CloudBees Flow looks for the pipeline reservation on the environment. A release follows the same pattern as the pipeline. The release will start immediately. However, when the deployer task begins deploying the application, the system will validate the reservation to make sure the appropriate environment reservation exists for that release. In both of these scenarios, the rules previously mentioned for application deployments apply to each of the applications that are deployed by the pipeline task and the deployer task.

Environment Reservation Use Case

ABC Bank is one of the leading banks that pride themselves for their cutting edge transaction processing system, which is leveraged by major businesses. Keeping systems up and running at all times is paramount to their business. This describes how environment reservations can be leveraged to streamline deployments by reducing deployments conflicts and improving system uptimes.

These are the main business rules for the production environment:

  1. No deployments can happen to production environments without proper approval. Approval is required primarily to make sure the deployment window is properly planned to reduce deployment conflicts and downtime.

  2. No deployments can happen on Sunday between noon and midnight. This is when all the transaction settlements (batch processing) happen, and the bank does not want any interruption or degradation of system performance during these critical times.

  3. Maintenance windows are on Friday nights from 10:00 P.M. to midnight. The bank has an application process for patching production machines.

  4. No deployments can happen between midnight and 6:00 P.M. on Monday through Friday because these times are considered critical business hours.

  5. At 7:00 P.M. on Friday, the "Online Banking" application needs an exclusive reservation to upgrade to newer version. No other deployments are allowed during this time because avoiding conflicts for this critical rollout is important.

To implement these rules, starting with the most restrictive clause:

  1. First implement the fourth rule by creating a recurring blackout from Monday though Friday between midnight and 6:00 P.M. This will ensure that no one will be able to deploy during this time period.

  2. Implement the second rule next by creating a recurring blackout on Sundays from noon to midnight. This will prevent anyone from deploying during the transaction settlement window.

  3. For the third rule, create a recurring exclusive reservation starting on Friday from 10:00 P.M. to midnight to deploy the application process used for system patching.

  4. For the fifth rule, create a recurring exclusive reservation for the "Online Banking" application starting on Friday at 7:00 P.M.

  5. For the first rule, start by setting the Reservation Required attribute on the production environment. This will prevent any unscheduled deployments to production. Then enhance the approval process to create an environment reservation during the available open deployment time periods for the application you want to deploy. It also makes sense to create an application run schedule to match the reservation.

The following are visual representations of the schedule for the production environment on Friday.

This shows the details for August 11 and 12 and also for August 18 and 19.

This is the daily view of the environment reservations for the production environment.

Conflict Resolution

If you try to deploy during the blackout or exclusive reservation windows in the previous section, the job will wait until the blackout period is over (given that the maximum job wait time is not exceeded).

When you try to create a reservation that conflicts with existing exclusive reservation, the job will also fail with the error:

Timeslots overlapping found in reservation Loan App Deploy and reseravation Online Banking App (FRI)

Environment Reservation UI

Restricting Deployments to Enabled Environments

You can restrict deployments to environments by selecting the Reservation Required option for an environment. In the Environment Details dialog, select Reservation Required and click OK. Deployment to this environment permitted only if an application, pipeline, or release has a valid reservation

Adding Environment Reservations

This example shows how to add environment reservations to the PROD environment. Starting from the Environments list:

  1. Select the environment to which you want to add reservations.

  2. In the Environment Editor, click in the upper right corner, and select Reservations. The dialog box showing the list of environment reservations opens.

  3. Click Add+ to add an environment reservation. The Environment Reservation Details dialog box opens.

  4. To create a blackout:

    1. In the Reservation name field, enter the name of the reservation.

    2. In the Start field, select the start date and enter the start time.

    3. In the End field, select the end date and enter the end time.

    4. In the Once field, select the frequency: Once, Daily, Weekly, or Monthly.

    5. (Optional) If you select Daily, Weekly, or Monthly, select the date when the reservation ends in the Recurrence Ends field.

    6. (Optional) Change the time zone.

    7. (Optional) Select Allow Overlap to make the reservation nonexclusive.

    8. Click Next. The Reservation for dialog box opens.

    9. (Optional) Select Only for a Tier if the reservation only applies to an environment tier.

    10. Select Blackout.

    11. Click OK. The Environment Reservations list returns and has been updated with the reservation you just created.

    12. (Optional) Click Add + to add another reservation.

  5. To create an exclusive invitation:

    1. In the Reservation name field, enter the name of the reservation.

    2. In the Start field, select the start date and enter the start time.

    3. In the End field, select the end date and enter the end time.

    4. In the Once field, select the frequency: Once, Daily, Weekly, Monthly.

    5. (Optional) If you select Daily, Weekly, or Monthly, select the date when the reservation ends in the Recurrence Ends field.

    6. (Optional) Change the time zone.

    7. (Optional) Select Allow Overlap to make the reservation nonexclusive.

    8. Click Next.

      The Reservation for dialog box opens.

    9. (Optional) Select Only for a Tier if the reservation only applies to an environment tier.

    10. Select the object that will have the reservation--Application, Pipeline, or Release--and the object’s project and object name.

    11. Click OK.

      The Environment Reservations list returns and has been updated with the reservation you just created.

Viewing Environment Reservation Calendars

There are two ways to access the environment reservation calendars:

  • From the Environment Reservations list, click for the calendar view.

  • From the Environments List, select an environment and click to view the Environment Reservations list. Then click at the upper right of the dialog box.

For examples of conflict resolution, see Conflict Resolution.