Skip to content

Commit 9e9ff20

Browse files
committed
feat: add snapcraft packaging and documentation
1 parent 54efce7 commit 9e9ff20

3 files changed

Lines changed: 91 additions & 3 deletions

File tree

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@
1414

1515
# Dependency directories (remove the comment below to include it)
1616
# vendor/
17-
terrakube
17+
terrakube
18+
19+
# Snapcraft build artifacts
20+
*.snap
21+
.craft/
22+
parts/
23+
prime/
24+
stage/

README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ For full CLI reference documentation, visit our official guide at [https://docs.
77
## Table of Contents
88

99
- [Download & Installation](#download--installation)
10-
- [Adding Terrakube CLI to PATH](#adding-terrakube-cli-to-path)
10+
- [Snap Package (Ubuntu / Linux)](#snap-package-ubuntu--linux)
1111
- [Linux & macOS](#linux--macos)
1212
- [Windows](#windows)
13+
- [Adding Terrakube CLI to PATH](#adding-terrakube-cli-to-path)
14+
- [Linux & macOS](#linux--macos-1)
15+
- [Windows](#windows-1)
1316
- [Building & Testing from Source](#building--testing-from-source)
1417
- [Compiling the Binary](#compiling-the-binary)
18+
- [Building Snap Package Locally](#building-snap-package-locally)
1519
- [Running Unit Tests](#running-unit-tests)
1620
- [Running End-to-End (BATS) Tests](#running-end-to-end-bats-tests)
1721
- [Quick Start Guide](#quick-start-guide)
@@ -28,7 +32,22 @@ For full CLI reference documentation, visit our official guide at [https://docs.
2832

2933
## Download & Installation
3034

31-
You can download pre-compiled binaries directly from our [GitHub Releases](https://github.com/terrakube-io/terrakube-cli/releases/latest) page.
35+
You can download pre-compiled binaries directly from our [GitHub Releases](https://github.com/terrakube-io/terrakube-cli/releases/latest) page, or install via Snap on Linux/Ubuntu.
36+
37+
### Snap Package (Ubuntu / Linux)
38+
39+
You can install the local `.snap` package:
40+
41+
```bash
42+
sudo snap install --dangerous terrakube-cli_*.snap
43+
```
44+
45+
Both `terrakube` and `terrakube-cli` commands will be available:
46+
47+
```bash
48+
terrakube --version
49+
terrakube-cli --help
50+
```
3251

3352
### Linux & macOS (Bash / Zsh)
3453

@@ -141,6 +160,29 @@ Verify compilation:
141160
./terrakube --help
142161
```
143162

163+
### Building Snap Package Locally
164+
165+
To build the Snap package on Ubuntu/Linux:
166+
167+
1. Install `snapcraft`:
168+
```bash
169+
sudo snap install snapcraft --classic
170+
```
171+
172+
2. Build the snap:
173+
```bash
174+
# Build directly in container (LXD/Multipass):
175+
snapcraft
176+
177+
# Or build locally in destructive mode:
178+
snapcraft --destructive-mode
179+
```
180+
181+
3. Install the locally generated `.snap` package:
182+
```bash
183+
sudo snap install --dangerous terrakube-cli_*.snap
184+
```
185+
144186
### Running Unit Tests
145187

146188
Run unit tests across all Golang packages:

snap/snapcraft.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: terrakube-cli
2+
title: Terrakube CLI
3+
base: core24
4+
version: '0.5.0'
5+
summary: CLI tool for Terrakube
6+
description: |
7+
terrakube is a CLI tool to handle remote Terraform workspaces and modules
8+
in Terrakube organizations, managing the full execution lifecycle (plan, apply, destroy).
9+
license: Apache-2.0
10+
website: https://terrakube.io
11+
contact: https://github.com/terrakube-io/terrakube-cli/issues
12+
issues: https://github.com/terrakube-io/terrakube-cli/issues
13+
source-code: https://github.com/terrakube-io/terrakube-cli
14+
15+
grade: stable
16+
confinement: strict
17+
18+
apps:
19+
terrakube-cli:
20+
command: bin/terrakube
21+
plugs:
22+
- home
23+
- network
24+
- removable-media
25+
terrakube:
26+
command: bin/terrakube
27+
plugs:
28+
- home
29+
- network
30+
- removable-media
31+
32+
parts:
33+
terrakube-cli:
34+
plugin: go
35+
source: .
36+
build-snaps:
37+
- go/latest/stable
38+
override-build: |
39+
go build -ldflags="-s -w" -o "${CRAFT_PART_INSTALL}/bin/terrakube" .

0 commit comments

Comments
 (0)