# vpctl release commands

> Pull, generate, deploy, and uninstall vpctl release commands

Use the `release` command group to manage the deployment lifecycle. Pull a release archive from the Unity registry, rendet Helm chart values from your manifest, deploy to your cluster or hand off to ArgoCD, and uninstall.

## Pull a release

Download a release from the registry. If you use a manifest file, the tool reads the version from the manifest automatically. By default, the release is extracted to `./extracted-release`.

```sh
vpctl release pull --clean-output
```

**Parameters:**

* `--extract-dir`: Directory to extract the archive to (default: `./extracted-release`).
* `--skip-extract`: Skip extracting the downloaded archive (default: extracts to `./extracted-release`).
* `--clean-output`: Clear the extraction directory before extracting.
* `--version`: Release version to pull (optional, defaults to value from manifest).
* `--registry`: Registry URL (default: `uccmpprivatecloud.azurecr.io`).
* `--output`: Output file path for the archive (default: `unity-private-cloud-<platform>-<version>.tar.gz`).

Example with manifest:

```sh
vpctl release pull --clean-output
```

Example without manifest, specify version:

```sh
vpctl release pull --version 1.2.3 --clean-output
```

Example with custom extraction directory:

```sh
vpctl release pull --extract-dir ./my-release --clean-output
```

Example skipping extraction:

```sh
vpctl release pull --skip-extract
```

## Generate and deploy charts

Choose your deployment method: **Helm** or **ArgoCD**.

### Generate Helm charts

```sh
vpctl release generate --clean-output
```

**Parameters:**

* `--clean-output`: Clean the output directory before generating
* `--format`: Output format (`argocd` generates app-of-apps chart structure; omit for standard Helm charts)
* `--extracted-release`: Path to extracted release (defaults to `./extracted-release`)
* `--output`: Output directory (defaults to `generated-charts`)
* `--name`: Filter to generate only charts matching a name pattern
* `--skip-version-check`: Skip vpctl version compatibility check against the release package

Example:

```sh
vpctl release generate --extracted-release ./extracted-release --output ./my-charts --clean-output
```

### Deploy with Helm

Preview deployment (recommended):

```sh
vpctl release deploy --dry-run
```

If you're deploying Asset Manager for the first time, deploy the release in waves. Start with the lowest wave, use the `--wave` flag, for example \`-3, then validate the deployment before deploying the next wave. This ensures the release deploys in the correct order and all dependencies are satisfied.

Execute deployment:

```sh
vpctl release deploy
```

**Common options:**

* `--dry-run`: Show commands without executing.
* `--format`: Deployment format (`helm` or `argocd`; defaults to `helm`).
* `--charts-dir`: Directory containing charts (defaults to `generated-charts`).
* `--wave`: Deploy only a specific wave (Helm format only; for example, `-3` is lowest, `0` is highest).
* `--name`: Deploy only a single chart by name.
* `--wait`: Wait for each Helm release to complete before moving on (default: `true`; disable with `--wait=false`).
* `--timeout`: Timeout per Helm release when `--wait=true` (default: `10m`; ignored when `--wait=false`).
* `--retries`: Number of additional attempts after a failed Helm command (default: `0`). Useful for the CRD-not-yet-visible race that sometimes resolves on a second attempt.
* `--retry-delay`: Delay between retry attempts (default: `5s`; only meaningful when `--retries > 0`).
* `--dependency-update`: Update chart dependencies before deployment (default: true).
* `--helm-flags`: Additional Helm flags to pass to the command.

Example deploying a specific wave:

```sh
vpctl release deploy --wave -3
```

### Manifest defaults for ArgoCD

You can define ArgoCD parameters in the manifest under `deployment.argocd` so you don't need to pass them every time. CLI flags always take precedence over manifest values when both are provided.

```yaml
# manifest.yaml
deployment:
  argocd:
    repoURL: "https://github.com/org/repo.git"
    pathPrefix: "onprem/cluster1"
    destinationServer: "https://kubernetes.default.svc"
    targetRevision: "main"
```

When the tool reads a value from the manifest instead of a CLI flag, it prints a log message, for example, `Using argocd-repo-url from manifest: ...`.

### Helm chart mode

The `deployment.helmChartMode` field controls how Helm charts are sourced:

```yaml
# manifest.yaml
deployment:
  helmChartMode: "local"   # default: use charts from the release package
```

| Value               | Behavior                                                                                                                                                                                                                                             |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `"local"` (default) | All charts are installed from the release package. This is the safe default for existing installations and airgapped environments.                                                                                                                   |
| `"remote"`          | Charts marked as `type: "remote"` in `versions.yaml` are pulled from an OCI Helm registry at deploy time. Only `values.yaml` is generated locally; chart templates come from the registry. Requires syncing remote charts for airgapped deployments. |

If you omit this field, the tool uses `"local"`. Set `helmChartMode: "remote"` to opt in to OCI remote charts.

### Generate ArgoCD application

If you set `deployment.argocd` in the manifest, you only need to pass flags you want to override:

```sh
vpctl release generate --format argocd --clean-output
```

Or override specific values for each run:

```sh
vpctl release generate --format argocd --argocd-path-prefix <path-prefix> --argocd-target-revision <branch-or-tag> --clean-output
```

You can still pass all flags explicitly, they take precedence over the manifest:

```sh
vpctl release generate --format argocd --argocd-repo-url <your-git-repo-url> --argocd-destination "https://kubernetes.default.svc" --argocd-target-revision "main" --argocd-path-prefix <path-prefix> --clean-output
```

**Parameters:**

* `--format argocd`: Generate ArgoCD format
* `--argocd-repo-url`: Git repository URL where charts are stored (can be set in manifest `deployment.argocd.repoURL`)
* `--argocd-destination`: Kubernetes server URL (can be set in manifest `deployment.argocd.destinationServer`)
* `--argocd-target-revision`: Git branch/tag to use (can be set in manifest `deployment.argocd.targetRevision`)
* `--argocd-path-prefix`: Path prefix in the Git repository (can be set in manifest `deployment.argocd.pathPrefix`)
* `--clean-output`: Clean output directory before generating

This command creates an app-of-apps chart structure in the output directory.

### Deploy ArgoCD application

Preview deployment (recommended):

```sh
vpctl release deploy --format argocd --dry-run
```

Execute deployment:

```sh
vpctl release deploy --format argocd
```

**Common options:**

* `--format argocd`: Use ArgoCD deployment
* `--dry-run`: Preview kubectl command without executing
* `--charts-dir`: Directory containing charts (defaults to `generated-charts`)

## Uninstall a release

To remove a deployed release, use the uninstall command. The tool uninstalls charts in reverse wave order with the highest wave first to ensure dependencies are removed correctly.

Preview uninstall commands (recommended):

```sh
vpctl release uninstall --dry-run
```

Execute uninstall:

```sh
vpctl release uninstall
```

**Common options:**

* `--dry-run`: Show commands without executing
* `--charts-dir`: Directory containing charts (defaults to `generated-charts`)
* `--wave`: Uninstall only charts in the specified wave (for example `-3` is lowest, `0` is highest)
* `--name`: Uninstall only a single chart (chart name)

Example uninstalling a specific wave:

```sh
vpctl release uninstall --wave 0 --dry-run
```

Example uninstalling a specific chart:

```sh
vpctl release uninstall --name my-chart --dry-run
```

The uninstall command uses `helm uninstall` for Helm-deployed charts and `helm template | kubectl delete` for charts deployed with templateApply, such as. kube-prometheus-stack.
