Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ builds:
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
Expand All @@ -34,6 +35,7 @@ builds:
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
Expand All @@ -48,16 +50,25 @@ archives:
- id: harness-bundle
ids: [harness-core, harness-plugin-har]
formats: [tar.gz]
format_overrides:
- goos: windows
formats: [zip]
name_template: "harness-bundle_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

- id: harness-core
ids: [harness-core]
formats: [tar.gz]
format_overrides:
- goos: windows
formats: [zip]
name_template: "harness-core_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

- id: harness-plugin-har
ids: [harness-plugin-har]
formats: [tar.gz]
format_overrides:
- goos: windows
formats: [zip]
name_template: "harness-plugin-har_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

nfpms:
Expand Down
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ with a single consistent grammar.

[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![Made with Go](https://img.shields.io/badge/Made_with-Go-00ADD8.svg?logo=go)](https://go.dev)
[![Platform: macOS · Linux](https://img.shields.io/badge/Platform-macOS_·_Linux-lightgrey.svg)](#install)
[![Platform: macOS · Linux · Windows](https://img.shields.io/badge/Platform-macOS_·_Linux_·_Windows-lightgrey.svg)](#install)
[![Releases](https://img.shields.io/badge/Downloads-GitHub_Releases-brightgreen.svg)](https://github.com/harness/cli/releases)

[Install](#-install) ·
Expand Down Expand Up @@ -65,25 +65,38 @@ with a single consistent grammar.

### Recommended: one-line installer

**macOS / Linux**

```sh
curl -fsSL https://raw.githubusercontent.com/harness/cli/main/install.sh | sh
```

**Windows (PowerShell)**

```powershell
irm https://raw.githubusercontent.com/harness/cli/main/install.ps1 | iex
```

The installer will:

- Download the latest `harness-bundle` for your platform (macOS and Linux, `amd64` / `arm64`).
- Install the `harness` and `harness-har` binaries to `~/.local/bin` (override with `--install-dir`).
- Optionally add `~/.local/bin` to your `PATH` and enable shell completions.
- Download the latest `harness-bundle` for your platform (macOS, Linux, and Windows — `amd64` / `arm64`).
- Install `harness` and `harness-har` to `~/.local/bin` on Unix or `%LOCALAPPDATA%\Programs\harness` on Windows (override with `--install-dir` / `-InstallDir`).
- Optionally add the install directory to your `PATH` and enable shell completions.

### Installer flags

| Flag | Description |
| ---------------------- | -------------------------------------------------------------- |
| `--install-dir <path>` | Override the install directory (default: `~/.local/bin`) |
| `--install-dir <path>` | Override the install directory (default: `~/.local/bin` on Unix, `%LOCALAPPDATA%\Programs\harness` on Windows) |
| `--core` | Install only the `harness` binary (skip `harness-har`) |
| `--non-interactive` | Skip all prompts (useful for CI, Docker, provisioning scripts) |
| `--no-verify` | Skip checksum verification |

Windows PowerShell flags: `-InstallDir`, `-Version`, `-Core`, `-NonInteractive`, `-NoVerify`.

> [!NOTE]
> `install.ps1` reads assets from GitHub Releases by default. Set `HARNESS_INSTALL_BASE_URL` to a local directory or internal mirror holding the release zip and checksums file to install from there instead — useful for air-gapped environments and for testing unreleased builds.

> [!TIP]
> When passing flags through a pipe, use `sh -s --` — `-s` tells `sh` to read from stdin, and `--` separates `sh`'s own options from the installer flags.

Expand All @@ -98,9 +111,17 @@ curl -fsSL https://raw.githubusercontent.com/harness/cli/main/install.sh | sh -s
curl -fsSL https://raw.githubusercontent.com/harness/cli/main/install.sh | sh -s -- --non-interactive --install-dir /usr/local/bin
```

```powershell
# Windows — install core + har bundle (default)
irm https://raw.githubusercontent.com/harness/cli/main/install.ps1 | iex

# Windows — core only, non-interactive
$env:HARNESS_NONINTERACTIVE=1; $env:HARNESS_CORE_ONLY=1; irm https://raw.githubusercontent.com/harness/cli/main/install.ps1 | iex
```

### Manual install

Prefer to install by hand? Download an archive from [GitHub Releases](https://github.com/harness/cli/releases) and place the binaries on your `PATH`. Both `tar.gz` bundles (core + `har`) and per-binary archives are published for `linux_amd64`, `linux_arm64`, `darwin_amd64`, and `darwin_arm64`.
Prefer to install by hand? Download an archive from [GitHub Releases](https://github.com/harness/cli/releases) and place the binaries on your `PATH`. Unix bundles are `tar.gz`; Windows bundles are `zip`. Published for `linux_amd64`, `linux_arm64`, `darwin_amd64`, `darwin_arm64`, `windows_amd64`, and `windows_arm64`.

This is also the path to take if `curl | sh` doesn't work in your environment — e.g. WSL behind a corporate SSL-inspecting proxy, air-gapped/vetted-binary environments, or scripted installs — see [`docs/manual-install.md`](docs/manual-install.md) for step-by-step instructions.

Expand Down
31 changes: 31 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ tasks:
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o ../../bin/harness-har ./cmd/harness-har/main-harness-har.go

build:windows:
desc: Cross-compile Windows binaries (harness.exe + harness-har.exe)
deps: [build:windows:main, build:windows:har]

build:windows:main:
desc: Cross-compile harness.exe for Windows amd64
env:
GOOS: windows
GOARCH: amd64
CGO_ENABLED: 0
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o bin/harness.exe {{.MAIN}}

build:windows:har:
desc: Cross-compile harness-har.exe for Windows amd64
dir: modules/har
env:
GOOS: windows
GOARCH: amd64
CGO_ENABLED: 0
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o ../../bin/harness-har.exe ./cmd/harness-har/main-harness-har.go

build:opt:
desc: Build all optimized binaries (stripped symbols, no DWARF)
deps: [build:opt:main, build:opt:har]
Expand All @@ -55,6 +78,14 @@ tasks:
- mkdir -p ~/.local/bin
- cp bin/{{.BINARY}} ~/.local/bin/{{.BINARY}}
- echo "Installed ~/.local/bin/{{.BINARY}}"

install:har:
desc: Build and install harness-har binary to ~/.local/bin
deps: [build:har, install]
cmds:
- mkdir -p ~/.local/bin
- cp ./bin/harness-har ~/.local/bin/harness-har
- echo "Installed ~/.local/bin/harness-har"

dev:
desc: Run without ldflags (version shows 0.1.0-dev / dev)
Expand Down
65 changes: 49 additions & 16 deletions docs/manual-install.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
# Manual Install

The [one-line installer](../install.sh) (`curl -fsSL .../install.sh | sh`) is the recommended
way to install the CLI. Use the steps below instead if `curl` can't reach GitHub in your
environment (e.g. WSL behind a corporate SSL-inspecting proxy), you need a vetted binary from
The [one-line installers](../install.sh) (`curl -fsSL .../install.sh | sh` on Unix,
`irm .../install.ps1 | iex` on Windows) are the recommended way to install the CLI.
Use the steps below instead if the installer can't reach GitHub in your environment
(e.g. WSL behind a corporate SSL-inspecting proxy), you need a vetted binary from
an internal mirror, or you're baking the install into a script/Dockerfile.

This covers macOS and Linux (`amd64` / `arm64`). There's no Windows release yet.
This covers macOS, Linux, and Windows (`amd64` / `arm64`).

## 1. Get the release archive

Releases live at [github.com/harness/cli/releases](https://github.com/harness/cli/releases).
Pick a version (or use `latest`) and find the asset for your platform:

| Platform | Asset name pattern |
| -------------------- | ------------------------------------------------ |
| Linux x86_64 | `harness-bundle_<version>_linux_amd64.tar.gz` |
| Linux ARM64 | `harness-bundle_<version>_linux_arm64.tar.gz` |
| macOS Intel | `harness-bundle_<version>_darwin_amd64.tar.gz` |
| macOS Apple Silicon | `harness-bundle_<version>_darwin_arm64.tar.gz` |
| Platform | Asset name pattern |
| --------------------- | ------------------------------------------------ |
| Linux x86_64 | `harness-bundle_<version>_linux_amd64.tar.gz` |
| Linux ARM64 | `harness-bundle_<version>_linux_arm64.tar.gz` |
| macOS Intel | `harness-bundle_<version>_darwin_amd64.tar.gz` |
| macOS Apple Silicon | `harness-bundle_<version>_darwin_arm64.tar.gz` |
| Windows x86_64 | `harness-bundle_<version>_windows_amd64.zip` |
| Windows ARM64 | `harness-bundle_<version>_windows_arm64.zip` |

`harness-bundle_*` contains both `harness` and `harness-har`. If you only need the core CLI,
use `harness-core_<version>_<os>_<arch>.tar.gz` instead — it contains just `harness`.
`harness-bundle_*` contains both `harness` and `harness-har` (`.exe` on Windows).
If you only need the core CLI, use `harness-core_<version>_<os>_<arch>.tar.gz` (Unix)
or `.zip` (Windows) instead — it contains just `harness`.

Also grab `harness_<version>_checksums.txt` from the same release, for step 2.

Expand All @@ -33,16 +37,27 @@ mounted under `/mnt/c/...`, so a file saved to Windows' Downloads folder is usua

Confirm the archive wasn't corrupted or tampered with in transit:

**Unix (`tar.gz`):**

```sh
grep harness-bundle_<version>_<os>_<arch>.tar.gz harness_<version>_checksums.txt
sha256sum harness-bundle_<version>_<os>_<arch>.tar.gz # Linux
shasum -a 256 harness-bundle_<version>_<os>_<arch>.tar.gz # macOS
```

The hash printed by `sha256sum`/`shasum` should match the one from the `grep` line above.
**Windows (`zip`):**

```powershell
Select-String harness-bundle_<version>_windows_amd64.zip harness_<version>_checksums.txt
Get-FileHash harness-bundle_<version>_windows_amd64.zip -Algorithm SHA256
```

The hash printed should match the one from the checksums file.

## 3. Extract and install the binaries

**Unix:**

```sh
tar -xzf harness-bundle_<version>_<os>_<arch>.tar.gz -C /tmp/harness-install
mkdir -p ~/.local/bin
Expand All @@ -51,8 +66,17 @@ mv /tmp/harness-install/harness-har ~/.local/bin/harness-har # skip if using h
chmod +x ~/.local/bin/harness ~/.local/bin/harness-har
```

`~/.local/bin` matches the default installer location, but any directory on your `PATH`
works — `/usr/local/bin` is a common system-wide alternative.
**Windows (Command Prompt or PowerShell):**

```powershell
Expand-Archive harness-bundle_<version>_windows_amd64.zip -DestinationPath $env:TEMP\harness-install
New-Item -ItemType Directory -Force -Path "$env:LOCALAPPDATA\Programs\harness"
Copy-Item "$env:TEMP\harness-install\harness.exe" "$env:LOCALAPPDATA\Programs\harness\"
Copy-Item "$env:TEMP\harness-install\harness-har.exe" "$env:LOCALAPPDATA\Programs\harness\"
```

`~/.local/bin` (Unix) and `%LOCALAPPDATA%\Programs\harness` (Windows) match the default
installer locations, but any directory on your `PATH` works.

## 4. Add to PATH and enable completions

Expand All @@ -72,14 +96,23 @@ export PATH="$HOME/.local/bin:$PATH"
source <(harness completion zsh)
```

Then reload the shell (`source ~/.bashrc` or `source ~/.zshrc`) or open a new terminal.
**PowerShell** — add to your profile:

```powershell
$env:Path = "$env:LOCALAPPDATA\Programs\harness;" + $env:Path
harness completion powershell | Out-String | Invoke-Expression
```

Then reload the shell or open a new terminal.

## 5. Verify

```sh
harness version
```

On Windows Command Prompt, use `harness.exe version` if the install directory is not yet on `PATH`.

## Upgrading later

Once installed, `harness install cli` can upgrade in place — see the
Expand Down
Loading
Loading