> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirurobotics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Staging area

export const OperatorBadge = ({size = "md"}) => {
  return <Tooltip tip="Members with the operator role can execute this action." cta="Workspace roles" href="/admin/users/access-control">
            <Badge icon="wrench" color="orange" size={size}>operator</Badge>
        </Tooltip>;
};

export const Framed = ({image, background, link, alt = "Framed content", borderWidth = "24px", outerRadius = "10px", innerRadius = "6px"}) => {
  const parseShorthand = value => {
    const values = String(value).trim().split(/\s+/);
    switch (values.length) {
      case 1:
        return [values[0], values[0], values[0], values[0]];
      case 2:
        return [values[0], values[1], values[0], values[1]];
      case 3:
        return [values[0], values[1], values[2], values[1]];
      default:
        return values.slice(0, 4);
    }
  };
  const isZero = v => parseFloat(v) === 0;
  const padding = parseShorthand(borderWidth);
  const outer = parseShorthand(outerRadius);
  const cornerMasks = [];
  if (isZero(padding[0]) && isZero(padding[3])) {
    cornerMasks.push(`radial-gradient(circle at 0% 0%, transparent ${outer[0]}, black ${outer[0]})`);
  }
  if (isZero(padding[0]) && isZero(padding[1])) {
    cornerMasks.push(`radial-gradient(circle at 100% 0%, transparent ${outer[1]}, black ${outer[1]})`);
  }
  if (isZero(padding[2]) && isZero(padding[1])) {
    cornerMasks.push(`radial-gradient(circle at 100% 100%, transparent ${outer[2]}, black ${outer[2]})`);
  }
  if (isZero(padding[2]) && isZero(padding[3])) {
    cornerMasks.push(`radial-gradient(circle at 0% 100%, transparent ${outer[3]}, black ${outer[3]})`);
  }
  const backgroundMask = cornerMasks.length > 0 ? cornerMasks.join(", ") : undefined;
  const innerImage = <img src={image} alt={alt} noZoom={link ? true : false} style={{
    display: "block",
    width: "100%",
    margin: 0,
    borderRadius: 0
  }} />;
  return <div style={{
    display: "inline-block",
    position: "relative",
    borderRadius: outerRadius,
    overflow: "hidden"
  }}>
            {}
            {background && <div style={{
    position: "absolute",
    inset: 0,
    backgroundImage: `url(${background})`,
    backgroundSize: "cover",
    maskImage: backgroundMask,
    WebkitMaskImage: backgroundMask,
    maskComposite: "intersect",
    WebkitMaskComposite: "source-in"
  }} />}
            {}
            <div style={{
    position: "relative",
    padding: borderWidth
  }}>
                <div style={{
    borderRadius: innerRadius,
    overflow: "hidden",
    lineHeight: 0
  }}>
                    {link ? <a href={link}>{innerImage}</a> : innerImage}
                </div>
            </div>
        </div>;
};

<Framed background="https://assets.mirurobotics.com/docs/v04/images/releases/background.jpeg" image="https://assets.mirurobotics.com/docs/v04/images/releases/stage/header:page.png" borderWidth="30px 0 0 48px" innerRadius="8px 0 0 0" />

## Overview

The staging area for a release is where deployments are created in preparation for a
future rollout. The staging area only contains staged deployments. Currently deployed
and previously deployed deployments are not accessible in the staging area.

Deployments in the staging area can be created freely *before* being deployed to
devices, making it an ideal place to prepare and review them before rolling them out.

Each release has its own staging area, entirely separate from other releases' staging
areas. This separation allows deployments to be staged for multiple releases
simultaneously.

The staging area is also handy for batch operations. Deployments can be created,
deployed, and archived in bulk, which helps manage large numbers of deployments at once.

## View the staging area

To view a release's staging area, navigate to the
[Releases page](https://app.mirurobotics.com/releases)
and click into a release.

<Frame>
  ![Releases Page](https://assets.mirurobotics.com/docs/v04/images/releases/page.png)
</Frame>

Then select the **Stage** tab at the top of the page.

<Frame>
  ![Staging Area Page](https://assets.mirurobotics.com/docs/v04/images/releases/stage/page.png)
</Frame>

## Stage a deployment  <OperatorBadge />

Staging a deployment creates a new deployment in the staging area but does not deploy it
to any devices.

Only one deployment can be staged per device at a time. If a release already has a
deployment staged for a device, staging a new deployment will replace the existing
deployment.

To stage a deployment, click the **Stage** button in the top right. If there are no
staged deployments yet, click **Stage Deployment** in the empty state instead.

<Frame>
  ![](https://assets.mirurobotics.com/docs/v04/images/releases/stage/empty-staging.png)
</Frame>

A dialog will appear listing the devices that can be staged for this release. Select the
device you want to create a staged deployment for.

<Frame>
  ![](https://assets.mirurobotics.com/docs/v04/images/releases/stage/select-device.png)
</Frame>

<Note>
  Some devices may be unavailable for selection. These devices are already running this
  release and cannot be staged from this flow. You can only stage deployments for
  devices that are running a *different release*.
</Note>

After selecting a device, the release editor opens. The editor is pre-filled with the
device's current configurations when available. If the device does not have a current
deployment, the editor uses the release schema default values instead.

<Frame>
  ![](https://assets.mirurobotics.com/docs/v04/images/releases/stage/release-editor-tooltip.png)
</Frame>

Review the configuration tabs and make any edits you want. When you are ready, click
**Stage** in the editor panel.

<Frame>
  ![](https://assets.mirurobotics.com/docs/v04/images/releases/stage/stage-button.png)
</Frame>

A dialog will appear asking for a description. Enter a description for the staged
deployment, then click **Stage**.

<Frame>
  ![](https://assets.mirurobotics.com/docs/v04/images/releases/stage/stage-dialog.png)
</Frame>

Miru will return you to the staging area, where the new staged deployment appears in the
list for the selected device.

<Frame>
  ![](https://assets.mirurobotics.com/docs/v04/images/releases/stage/staged-deployment.png)
</Frame>

## View a deployment

To view a deployment in the staging area, select it from the list.

A panel will open on the right of the page displaying the deployment's details.

<Frame>
  ![Staged Deployment Panel](https://assets.mirurobotics.com/docs/v04/images/deployments/staged-panel.png)
</Frame>

To view the details of any config instances in the deployment, click into the config
instance in the **Configurations** section of the panel.

<Frame>
  ![Staged Deployment Configurations](https://assets.mirurobotics.com/docs/v04/images/deployments/staged-panel:configurations.png)
</Frame>

The content tab contains the config instance's parameters, while the metadata tab
contains audit information—the author, creation date, description, etc.

<Tabs>
  <Tab title="Content">
    <Frame>
      ![Staged Deployment Content](https://assets.mirurobotics.com/docs/v04/images/config-instances/panel-content:staged.png)
    </Frame>
  </Tab>

  <Tab title="Metadata">
    <Frame>
      ![Staged Deployment Metadata](https://assets.mirurobotics.com/docs/v04/images/config-instances/panel-metadata:staged.png)
    </Frame>
  </Tab>
</Tabs>

## Patch a deployment  <OperatorBadge />

Patching a deployment opens the release editor with the configuration content from an
existing staged deployment, allowing you to create a replacement staged deployment for
that device.

To patch a deployment, click the ellipses (...) on the deployment to patch and select
**Patch** from the dropdown.

<Frame>
  ![Patch Deployment Dropdown](https://assets.mirurobotics.com/docs/v04/images/releases/stage/patch-dropdown.png)
</Frame>

The release editor will open with the selected deployment's configurations populated in
each tab.

<Frame>
  ![Patch Deployment Editor](https://assets.mirurobotics.com/docs/v04/images/releases/stage/release-editor-patch.png)
</Frame>

Review the configurations and make any desired edits. When you are ready, click
**Stage** in the editor panel.
A dialog will appear asking for a description. Enter a description, then click
**Stage**.

After staging, Miru returns you to the staging area, where the updated staged deployment
appears in the list.

## Archive a deployment  <OperatorBadge />

Archiving a deployment removes it from the staging area and marks it as `archived`.

This action is irreversible. Once archived, a deployment can never be deployed to a
device. However, the deployment will remain available for historical reference.

**Single Deployment**

To archive a single deployment, click the ellipsis (...) on the deployment and select
**Archive** from the dropdown.

<Frame>
  ![Staged Deployment Ellipses Dropdown](https://assets.mirurobotics.com/docs/v04/images/releases/stage/ellipses-dropdown:staged.png)
</Frame>

A confirmation dialog will appear—hit **Archive** to confirm.

<Frame>
  ![Archive Staged Deployment Dialog](https://assets.mirurobotics.com/docs/v04/images/releases/stage/archive-dialog:single.png)
</Frame>

**Multiple Deployments**

To archive multiple deployments, hover over the deployments you want to archive and
select the checkbox in the far-left column.

<Frame>
  ![Select Deployments](https://assets.mirurobotics.com/docs/v04/images/releases/stage/select-devices.png)
</Frame>

At the bottom of the page, click **Archive** from the available bulk actions.

<Frame>
  ![Bulk Actions](https://assets.mirurobotics.com/docs/v04/images/releases/stage/bulk-actions.png)
</Frame>

A confirmation dialog will appear—hit **Archive** to confirm.

<Frame>
  ![Archive Bulk Deployments Dialog](https://assets.mirurobotics.com/docs/v04/images/releases/stage/archive-dialog:bulk.png)
</Frame>

## Deploy a deployment  <OperatorBadge />

Deploying a deployment removes the existing deployment from the device and replaces it
with the new deployment.

This action is irreversible. Once deployed, the only way to restore configurations is to
create a new deployment with the old configurations.

To deploy one or more deployments, hover over the deployments you want to deploy and
select their checkboxes in the far-left column.

<Frame>
  ![Select Deployments](https://assets.mirurobotics.com/docs/v04/images/releases/stage/select-devices.png)
</Frame>

At the bottom of the page, click **Deploy** from the available bulk actions.

<Frame>
  ![Bulk Actions](https://assets.mirurobotics.com/docs/v04/images/releases/stage/bulk-actions.png)
</Frame>

A confirmation dialog will appear. Hit **Deploy** to confirm.

<Frame>
  ![Deploy Bulk Deployments Dialog](https://assets.mirurobotics.com/docs/v04/images/releases/stage/deploy-dialog:bulk.png)
</Frame>

## Deployment drift

When a device receives configuration updates for its current release while having
deployments staged for another release, we say the staged deployment has *drifted*.

Consider the following example:

![Deployment Drift](https://assets.mirurobotics.com/docs/v04/images/deployments/deployment-drift.png)
Our device is currently running deployment `DPL-Npfzv`, which adheres to release `v1.5`.
Our device is about to be upgraded to release `v1.6` though, so we've staged deployment
`DPL-Q4CeX` for the upcoming upgrade.

However, before the upgrade occurs, our device receives some configuration updates on
release `v1.5`—`DPL-Npfzv` is patched with `DPL-BFwc3`. Since it's often the case that
this patch also needs to be applied to the staged deployment `DPL-Q4CeX`, we say
`DPL-Q4CeX` has *drifted*.

When a deployment drifts, it is marked as `drifted` and cannot be deployed until an
explicit review is performed. You must either ignore the patch or apply the patch to the
staged deployment.

The concept of deployment drift ensures that configuration changes aren't lost during
migrations between releases, preventing misconfigurations.

## Review a deployment  <OperatorBadge />

Reviewing a deployment is only possible when a deployment has
[drifted](#deployment-drift) and is in the `drifted` state. Otherwise, the review button
is disabled.

Reviewing a deployment displays the patches applied to a device since the last time the
deployment was reviewed (or since it was initially staged).

To review a deployment, click the ellipsis (...) on the deployment and select **Review**
from the dropdown.

<Frame>
  ![Drifted Deployment Ellipses Dropdown](https://assets.mirurobotics.com/docs/v04/images/releases/stage/ellipses-dropdown:drifted.png)
</Frame>

A dialog will appear with a list of deployments that have been patched to the device
since the last time the deployment was reviewed (or when it was initially staged).

<Frame>
  ![Review Deployments Dialog](https://assets.mirurobotics.com/docs/v04/images/releases/stage/review-dialog:deployments.png)
</Frame>

Clicking a deployment opens the deployment details panel on the right side of the page.

<Frame>
  ![Review Deployment Panel](https://assets.mirurobotics.com/docs/v04/images/releases/stage/deployment-panel:deployed.png)
</Frame>

Clicking a deployment's listed configuration opens that config instance's details panel,
with the differences highlighted.

<Frame>
  ![Review Deployment Config Panel](https://assets.mirurobotics.com/docs/v04/images/releases/stage/config-panel.png)
</Frame>

With the deployment's patches available for review, you have two options for proceeding.

**Restage**

The first option is to restage the deployment as-is, effectively ignoring the patches
that have occurred. This will move the deployment to the `staged` state and allow it to
be deployed.

<Frame>
  ![Review Restage Dialog](https://assets.mirurobotics.com/docs/v04/images/releases/stage/review-dialog:restage.png)
</Frame>

**Archive**

The second option is to [archive](#archive-a-deployment) the deployment. This removes
the deployment from the staging area and moves it to the `archived` state. Archived
deployments are available for historical reference but cannot be deployed.

<Frame>
  ![Review Archive Dialog](https://assets.mirurobotics.com/docs/v04/images/releases/stage/review-dialog:archive.png)
</Frame>

**Patch**

The ability to apply patches to a drifted deployment is currently unavailable, but will
be coming soon!
