# How to Update Your OpenSRE Installation: A Complete Guide

> Easily update your OpenSRE installation with a single command. Learn how to check for the latest release and upgrade automatically or non-interactively.

- Repository: [Tracer/opensre](https://github.com/Tracer-Cloud/opensre)
- Tags: how-to-guide
- Published: 2026-04-18

---

**Run `opensre update` to check for the latest release and upgrade automatically, or use `opensre update -y` for non-interactive installations.**

OpenSRE includes a built-in update mechanism that fetches the latest release from GitHub and upgrades your CLI automatically. Whether you installed via pip, Homebrew, or a binary distribution, you can update your OpenSRE installation using the integrated `opensre update` command.

## Understanding the OpenSRE Update Mechanism

The update system is implemented across several core modules that handle version detection, release fetching, and installation.

### How the Update Command Works

The `opensre update` sub-command is declared in [`app/cli/commands/general.py`](https://github.com/Tracer-Cloud/opensre/blob/main/app/cli/commands/general.py) (lines 45-58). When invoked, it calls the `run_update` function from [`app/cli/update.py`](https://github.com/Tracer-Cloud/opensre/blob/main/app/cli/update.py) (lines 95-102), which orchestrates the entire upgrade process.

The workflow follows these steps:

1. **Detect current version** via `app.version.get_version()` (lines 11-17), which returns the installed version with a fallback default of `2026.4.7`.
2. **Fetch latest release** from the GitHub API at `https://api.github.com/repos/Tracer-Cloud/opensre/releases/latest`.
3. **Compare versions** using `packaging.version.Version` in `_is_update_available()` (lines 40-48).
4. **Execute upgrade** by downloading and running the official [`install.sh`](https://github.com/Tracer-Cloud/opensre/blob/main/install.sh) or `install.ps1` script.

### Version Detection and Comparison

The `_fetch_latest_version()` function (lines 19-38) handles API communication, while `_is_update_available()` performs semantic version comparison. If the remote version exceeds the local version, the system prepares for upgrade.

## Updating OpenSRE Step by Step

### Check for Available Updates

Before installing, verify whether a newer version exists using the check-only mode:

```bash
opensre update --check

```

This command reports the current and latest versions without modifying your installation. It returns exit code 1 if an update is available, making it ideal for automated monitoring scripts.

### Interactive Update Process

For a guided upgrade experience, run the update command without flags:

```bash
opensre update

```

The system displays the current version (e.g., `2026.4.5`) and the latest available version (e.g., `2026.5.2`), then prompts for confirmation using `questionary.confirm` (lines 23-28). Upon approval, it downloads the appropriate installation script and upgrades your OpenSRE installation.

### Automated Update for CI/CD Pipelines

For non-interactive environments, use the auto-confirm flag:

```bash
opensre update -y

```

Or set the environment variable to force a specific version:

```bash
OPENSRE_VERSION=2026.5.0 opensre update -y

```

To completely disable update checks (useful in CI), set:

```bash
export OPENSRE_NO_UPDATE_CHECK=1

```

## Update Methods for Different Installation Types

### Binary and Package Manager Installations

For binary, pip, or Homebrew installations, the `_upgrade_via_install_script()` function (lines 74-92) downloads the official [`install.sh`](https://github.com/Tracer-Cloud/opensre/blob/main/install.sh) (Linux/macOS) or `install.ps1` (Windows) and executes it with the target version specified via the `OPENSRE_VERSION` environment variable.

### Editable Development Installations

If you installed OpenSRE in editable mode (`pip install -e .`), the updater detects this configuration and warns that the upgrade will replace your editable source with a released build (lines 20-22). This protects development environments from accidental overwrites.

## Environment Variables and Configuration

Control the update behavior using these environment variables:

- **`OPENSRE_NO_UPDATE_CHECK=1`** – Skips the network request to GitHub (useful for air-gapped or CI environments).
- **`OPENSRE_VERSION`** – Forces installation of a specific version rather than the latest.

## Summary

- OpenSRE provides a built-in `opensre update` command for seamless upgrades.
- The update mechanism checks GitHub releases, compares versions using semantic versioning, and executes the official install script.
- Use `opensre update --check` to verify available updates without installing.
- Use `opensre update -y` for automated, non-interactive upgrades.
- Set `OPENSRE_NO_UPDATE_CHECK=1` to disable update checks in CI environments.

## Frequently Asked Questions

### How do I check if an OpenSRE update is available without installing it?

Run `opensre update --check`. This command compares your current version against the latest GitHub release and reports the status without modifying your installation. It returns exit code 1 if a newer version exists, making it suitable for automation scripts.

### Can I update OpenSRE in a non-interactive environment?

Yes. Use the `-y` or `--yes` flag with `opensre update -y` to bypass the confirmation prompt. For CI pipelines, you can also set `OPENSRE_NO_UPDATE_CHECK=1` to skip network requests entirely, or use `OPENSRE_VERSION` to pin a specific version.

### What happens if I run opensre update on an editable installation?

The updater detects editable installations (installed via `pip install -e .`) and displays a warning. Since the update process replaces the source with a released build, it will overwrite your development environment. You should manually pull the latest source code instead of using the update command in this scenario.

### How does OpenSRE determine which version is the latest?

The update mechanism queries the GitHub Releases API at `https://api.github.com/repos/Tracer-Cloud/opensre/releases/latest` via the `_fetch_latest_version()` function in [`app/cli/update.py`](https://github.com/Tracer-Cloud/opensre/blob/main/app/cli/update.py). It then uses `packaging.version.Version` in `_is_update_available()` to perform semantic version comparison against the locally installed version detected by `app.version.get_version()`.