App Lifecycle Manager lets you update your SaaS offering across provisioned units by
creating new release versions with modified blueprints and deploying them
through rollouts. Rollouts target units by `UnitKind`, and you can filter
target subsets using CEL (`unit_filter`). You can also perform a *rollback* by
updating units to a previous release, or update a single unit from the
**Unit details** page.

## Before you begin

Before you update your SaaS offering, you should:

- Ensure you have [Enabled App Lifecycle Manager](https://docs.cloud.google.com/app-lifecycle-manager/enable-service.md.txt).
- Ensure you have the IAM permissions needed to create a SaaS offering.
- [Create a SaaS offering](https://docs.cloud.google.com/app-lifecycle-manager/create-saas-offering.md.txt).
- [Create a unit kind](https://docs.cloud.google.com/app-lifecycle-manager/design-saas-offering.md.txt).
- [Create and provision a Unit](https://docs.cloud.google.com/app-lifecycle-manager/deploy-saas-offering.md.txt).
- Prepare a new or modified Terraform blueprint.

## Create a release

Before you can update your SaaS offering, you must create a
*release* . A release represents a specific version of your SaaS application
that is defined by a blueprint package and its associated configurations.
Essentially, a release *contains the update* to your units.

### Console

1. Go to App Lifecycle Manager.

   [Go to App Lifecycle Manager](https://console.cloud.google.com/saas)

   <br />

2. Click **Releases**.

3. On the **Releases** page, click **Create**.

4. On the **Create Release** page:

   1. In the **Release name** box, enter a unique name for your release.
   2. In the **Unit kind** box, select the unit kind this release is associated with.
   3. In the **Only upgradeable from (optional)** section, you can optionally select releases that units can be upgraded from to this release. This lets you control upgrade paths.
   4. In the **Create Blueprint** and **Store Blueprint** steps, select or create your blueprint. Refer to [Blueprints documentation](https://docs.cloud.google.com/app-lifecycle-manager/blueprints.md.txt) for detailed information on blueprints creation options.
   5. In the **Variables (optional)** section, you can optionally set
      input variables for this release. Refer to
      [Variables documentation](https://docs.cloud.google.com/app-lifecycle-manager/variables.md.txt)
      for more information on setting variables.

      > [!NOTE]
      > **Note:** Rollouts reuse variables that were previously used during provisioning. For example, if you specified a `tenant_project_id` variable during provisioning, this variable will be reused when you create a rollout for this release. However, if you add a variable during new release creation all previously set values of `tenant_project_id` will be overridden.

5. Click **Create**.

6. You have created a release. You can view the release details on the
   **Release details** page. You will be able to reference this release
   when creating a rollout.

### gcloud

To create a release using Google Cloud console:

    gcloud app-lifecycle-manager releases create RELEASE_NAME --blueprint-package=BLUEPRINT_PACKAGE_URI --unit-kind=UNIT_KIND [--location=LOCATION] [--labels=[KEY=VALUE,...]] [--upgradeable-from-releases=[RELEASE_NAME,...]] [--input-variable-defaults=[variable=VARIABLE,value=VALUE,type=TYPE,...]]

Replace:

- `RELEASE_NAME`: The ID of the release you want to create. This will be part of the full resource name for the release.
- `BLUEPRINT_PACKAGE_URI`: The URI of the blueprint package to use for this release. Blueprints are OCI images hosted in Artifact Registry, or another OCI registry.
  - The blueprint package contains the artifacts required for you to provision a unit, and includes metadata about the engine used (Terraform), as well as the version.
  - If you omit the hostname in the URI, it defaults to the regional Artifact Registry path (`us-east1-docker.pkg.dev`, for example).
  - See [Blueprints documentation](https://docs.cloud.google.com/app-lifecycle-manager/blueprints.md.txt) for more information on creating blueprints.
- `UNIT_KIND`: The ID or fully qualified identifier for the unit kind this release corresponds to. <var translate="no">UNIT_KIND</var> is immutable after you create a release.
- `LOCATION`: The location where you want to create the release. This flag provides a fallback value for the release location if the full URI path is not provided. Defaults to the location configured in your Google Cloud CLI environment.
- `LABELS`: (Optional) Labels to apply to the release for categorization. Labels are key-value pairs.
  - Keys must start with a lowercase character and contain only hyphens, underscores, lowercase characters, and numbers.
  - Values must contain only hyphens, underscores, lowercase characters, and numbers.
  - For example: `--labels=environment=staging,team=app-lifecycle-manager`
- `UPGRADEABLE_FROM_RELEASES`: (Optional) A comma-separated list of release names that specifies which existing releases can be updated with the new release you create.
  - If you leave this flag empty, there are no constraints on which releases can be updated to this release.
  - When provided, unit update requests to this release will enforce this constraint.
- `INPUT_VARIABLE_DEFAULTS`: (Optional) Default values for input variables required by the blueprint.
  - You can specify variable defaults inline or by referencing a YAML or JSON file.
  - Variables defined here can be overridden during rollout creation.

> [!NOTE]
> **Note:** Rollouts reuse variables that were previously used during provisioning. For example, if you specify a `tenant_project_id` variable during provisioning, this variable will be reused when you create a rollout for this release unless explicitly overridden.

For more information on setting variables, see [Variables documentation](https://docs.cloud.google.com/app-lifecycle-manager/variables.md.txt).
For more information about releases, see [`Release`](https://docs.cloud.google.com/sdk/gcloud/reference/app-lifecycle-manager/releases/create.md.txt) Google Cloud CLI reference.

## Create a rollout kind

Before you can create a *rollout* , you need to create a *rollout kind* that
serves as a template for how your release is deployed to your units.

### Console

1. Go to App Lifecycle Manager.

   [Go to App Lifecycle Manager](https://console.cloud.google.com/saas)

   <br />

2. Click **Rollout kinds**.

3. On the **Rollout Kinds** page, click **Create**.

4. On the **Create a rollout kind** page:

   1. In the **Rollout kind name** box, enter a name for your rollout kind.
   2. In the **Unit kind** box, select the unit kind detailing the type of unit you want to update with the release.
   3. In the **Rollout strategy** drop-down, select the strategy you would
      like to use to deploy the release to your units:

      - **One location at a time (simple)**: Updates one location at a time (without soak times). Updates up to 5% of units concurrently.
      - **All at once (simple)**: All locations begin updating simultaneously (ideal for development environments and emergency scenarios).
      - **Progressive (gradual)**: Gradually deploys updates in percentage batches exponentially across multiple locations (with soak times).
      - **Progressive (single location)**: Updates units in percentage batches with extended soak times to detect issues within a single location.

      For more information about rollout strategies, see [Rollout strategies](https://docs.cloud.google.com/app-lifecycle-manager/rollout-strategies.md.txt).
5. Click **Create**.

6. You have created a rollout kind. On the **Rollout Kind details** page,
   you can view and edit the parameters for your rollout kind.

### gcloud

To create a rollout kind using Google Cloud console:

      gcloud app-lifecycle-manager rollout-kinds create ROLLOUT_KIND_NAME --unit-kind=UNIT_KIND --location=LOCATION --rollout-orchestration-strategy=ROLLOUT_ORCHESTRATION_STRATEGY --error-budget-allowed-count=ERROR_BUDGET_ALLOWED_COUNT --error-budget-allowed-percentage=ERROR_BUDGET_ALLOWED_PERCENTAGE --unit-filter=UNIT_FILTER --update-unit-kind-strategy=UPDATE_UNIT_KIND_STRATEGY

Replace:

- `ROLLOUT_KIND_NAME`: The name of rollout kind.
- `UNIT_KIND`: Defines which units you want to apply releases to. Releases are applied to all units of the selected unit kind.
- `LOCATION`: The location where you want to create your rollout kind.
- `ROLLOUT_ORCHESTRATION_STRATEGY`: Defines the rollout
  strategy for your rollout kind. Possible values include:

  - `Google.Cloud.Simple.OneLocationAtATime`: Updates one location at a time (without soak times). Updates up to 5% of units concurrently.
  - `Google.Cloud.Simple.AllAtOnce`: All locations begin updating simultaneously (ideal for development environments and emergency scenarios).
  - `Google.Cloud.Progressive.Gradual.v1`: Gradually deploys updates in percentage batches exponentially across multiple locations (with soak times).
  - `Google.Cloud.Progressive.SingleLocation.v1`: Updates units in percentage batches with extended soak times to detect issues within a single location.

  For more information about rollout strategies, see [Rollout strategies](https://docs.cloud.google.com/app-lifecycle-manager/rollout-strategies.md.txt).
- `ERROR_BUDGET_ALLOWED_COUNT`: The maximum number of
  failed units allowed in a location without pausing the rollout.

- `ERROR_BUDGET_ALLOWED_PERCENTAGE`: The maximum
  percentage of units allowed to fail in a location without pausing the
  rollout. Must be greater than 0 and at most 100.

  If the number of failed units in a location exceeds the larger of
  `--error-budget-allowed-count` and `--error-budget-allowed-percentage`
  percent of the units, the rollout will be paused. If the error budget
  isn't set, App Lifecycle Manager will attempt to update all units
  regardless of the number of failures encountered.
- `UNIT_FILTER`:
  [CEL](https://github.com/google/cel-spec)
  formatted filter string used against units. The filter will be applied
  to determine the eligible unit population. This filter can only reduce
  the scope of the rollout. It cannot expand the rollout's scope.

- `UPDATE_UNIT_KIND_STRATEGY`: The strategy for
  updating the unit kind. By default, the unit kind will be updated on the
  rollout start. Possible values include:

  - `on-start`: Update the unit kind when the rollout starts.
  - `never`: Never update the unit kind.

For more information, see
[`RolloutKind`](https://docs.cloud.google.com/sdk/gcloud/reference/app-lifecycle-manager/rollout-kinds/create.md.txt)
Google Cloud CLI reference.

### Error budget feature

App Lifecycle Manager includes an error budget feature (`ErrorBudget` in
`RolloutKind`) as a safeguard. This can automatically pause a rollout if the
number or percentage of unit update failures (during infrastructure application,
for example) exceeds a configured threshold, helping to limit the impact of
potential issues during an update.

## Create a rollout

After you've created a rollout kind, you can create a rollout that specifies the
release you want to update your units with.

Once the rollout is created, App Lifecycle Manager updates your units according
to the strategy defined in the unit kind.

### Console

1. Go to App Lifecycle Manager.

   [Go to App Lifecycle Manager](https://console.cloud.google.com/saas)

   <br />

2. Click **Rollouts.**

3. On the **Rollout List** page, click **Create**.

4. On the **Create a rollout** page:

   1. In the **Rollout Kind** box, select the rollout kind detailing how to deploy your release to the specified units.
   2. In the **Release** box, specify the release to update the units with.
   3. In the **Rollout Name** box, enter a name for your rollout.
5. Click **Create**.

6. Your rollout has been created.

   On the **Global Rollout Detail** page, you can monitor rollout details
   including the rollout state, rollout progress (by unit count), and
   rollout failures.

### gcloud

To create a rollout using Google Cloud console:

      gcloud app-lifecycle-manager rollouts create ROLLOUT_NAME --rollout-kind=ROLLOUT_KIND_NAME --release=RELEASE_NAME --location=LOCATION

Replace:

- `ROLLOUT_NAME`: The name of the rollout.
- `ROLLOUT_KIND_NAME`: Defines which rollout kind you want to use to apply releases to your units. Releases are applied to all units of the unit kind defined in the rollout kind.
- `RELEASE_NAME`: Defines the release binary you want to deploy to your units.
- `LOCATION`: The location where you want to create your rollout.

For more information, see
[`Rollout`](https://docs.cloud.google.com/sdk/gcloud/reference/app-lifecycle-manager/rollouts/create.md.txt)
Google Cloud CLI reference.

## What's next

- To understand more about App Lifecycle Manager, see [App Lifecycle Manager overview](https://docs.cloud.google.com/app-lifecycle-manager/overview.md.txt).
- To get try a tutorial see [Deploy a MySQL instance with App Lifecycle Manager](https://docs.cloud.google.com/app-lifecycle-manager/deploy-sql).
- To understand how service accounts are used and how to grant granular permissions for these accounts, see [App Lifecycle Manager service accounts](https://docs.cloud.google.com/app-lifecycle-manager/service-accounts.md.txt#actuation-sa).