Skip to content

Commit 5d851af

Browse files
committed
Initial release
0 parents  commit 5d851af

File tree

19 files changed

+2518
-0
lines changed

19 files changed

+2518
-0
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.21'
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v5
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
# Go workspace file
18+
go.work
19+
20+
# Binary
21+
/gitlab-runner-tui
22+
gitlab-runner-tui
23+
24+
# Build directories
25+
/build/
26+
/dist/
27+
28+
# IDE specific files
29+
.idea/
30+
.vscode/
31+
*.swp
32+
*.swo
33+
*~
34+
35+
# OS specific files
36+
.DS_Store
37+
Thumbs.db
38+
39+
# Specstory
40+
.specstory

.goreleaser.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- amd64
16+
- arm64
17+
- arm
18+
goarm:
19+
- 7
20+
main: ./cmd/gitlab-runner-tui
21+
binary: gitlab-runner-tui
22+
ldflags:
23+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
24+
25+
archives:
26+
- format: tar.gz
27+
name_template: >-
28+
{{ .ProjectName }}_
29+
{{- title .Os }}_
30+
{{- if eq .Arch "amd64" }}x86_64
31+
{{- else if eq .Arch "386" }}i386
32+
{{- else }}{{ .Arch }}{{ end }}
33+
{{- if .Arm }}v{{ .Arm }}{{ end }}
34+
format_overrides:
35+
- goos: windows
36+
format: zip
37+
38+
checksum:
39+
name_template: 'checksums.txt'
40+
41+
snapshot:
42+
name_template: "{{ incpatch .Version }}-next"
43+
44+
changelog:
45+
sort: asc
46+
filters:
47+
exclude:
48+
- '^docs:'
49+
- '^test:'
50+
51+
release:
52+
github:
53+
owner: larkin
54+
name: gitlab-runner-tui
55+
draft: false
56+
prerelease: auto

Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.PHONY: build clean install run test lint
2+
3+
BINARY_NAME=gitlab-runner-tui
4+
BUILD_DIR=build
5+
INSTALL_DIR=/usr/local/bin
6+
7+
build:
8+
@echo "Building $(BINARY_NAME)..."
9+
@mkdir -p $(BUILD_DIR)
10+
@go build -o $(BUILD_DIR)/$(BINARY_NAME) cmd/gitlab-runner-tui/main.go
11+
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
12+
13+
clean:
14+
@echo "Cleaning..."
15+
@rm -rf $(BUILD_DIR)
16+
@go clean
17+
18+
install: build
19+
@echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..."
20+
@sudo cp $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_DIR)/
21+
@sudo chmod +x $(INSTALL_DIR)/$(BINARY_NAME)
22+
@echo "Installation complete"
23+
24+
run: build
25+
@echo "Running $(BINARY_NAME)..."
26+
@./$(BUILD_DIR)/$(BINARY_NAME)
27+
28+
test:
29+
@echo "Running tests..."
30+
@go test -v ./...
31+
32+
lint:
33+
@echo "Running linter..."
34+
@golangci-lint run || go vet ./...
35+
36+
deps:
37+
@echo "Downloading dependencies..."
38+
@go mod download
39+
@go mod tidy
40+
41+
dev:
42+
@echo "Running in development mode..."
43+
@go run cmd/gitlab-runner-tui/main.go

README.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# GitLab Runner TUI
2+
3+
A Terminal User Interface (TUI) for managing GitLab runners on Debian hosts. This tool provides an interactive way to monitor runners, view logs, and update configurations.
4+
5+
## Features
6+
7+
- **Runner Management**: View all configured GitLab runners with their status
8+
- **Log Viewer**: Real-time log viewing with filtering and auto-scroll
9+
- **Configuration Editor**: Update runner concurrency, limits, and other settings
10+
- **System Monitor**: View service status, CPU/memory usage, and restart services
11+
- **Keyboard Navigation**: Easy tab-based navigation between views
12+
13+
## Prerequisites
14+
15+
- Go 1.19 or higher
16+
- GitLab Runner installed on the system
17+
- Appropriate permissions to:
18+
- Read GitLab Runner configuration files
19+
- Execute `gitlab-runner` commands
20+
- Access system services (systemctl/service)
21+
- Read system logs (journalctl)
22+
23+
## Installation
24+
25+
### Quick Install (Recommended)
26+
27+
```bash
28+
# Download and install latest release
29+
curl -sSL https://raw.githubusercontent.com/larkin/gitlab-runner-tui/main/install.sh | bash
30+
31+
# Or with wget
32+
wget -qO- https://raw.githubusercontent.com/larkin/gitlab-runner-tui/main/install.sh | bash
33+
```
34+
35+
### Manual Download
36+
37+
Download the latest release for your platform from the [releases page](https://github.com/larkin/gitlab-runner-tui/releases).
38+
39+
```bash
40+
# Example for Linux x64
41+
curl -L https://github.com/larkin/gitlab-runner-tui/releases/latest/download/gitlab-runner-tui_Linux_x86_64.tar.gz | tar xz
42+
sudo mv gitlab-runner-tui /usr/local/bin/
43+
```
44+
45+
### Build from Source
46+
47+
```bash
48+
# Clone the repository
49+
git clone https://github.com/larkin/gitlab-runner-tui
50+
cd gitlab-runner-tui
51+
52+
# Build the binary
53+
go build -o gitlab-runner-tui cmd/gitlab-runner-tui/main.go
54+
55+
# Optional: Install to system path
56+
sudo cp gitlab-runner-tui /usr/local/bin/
57+
```
58+
59+
## Usage
60+
61+
```bash
62+
# Run with default config path (/etc/gitlab-runner/config.toml)
63+
gitlab-runner-tui
64+
65+
# Run with custom config path
66+
gitlab-runner-tui -config /path/to/config.toml
67+
68+
# If running without sudo, it will check ~/.gitlab-runner/config.toml
69+
```
70+
71+
## Keyboard Shortcuts
72+
73+
### Global
74+
- `Tab` / `Shift+Tab`: Navigate between tabs
75+
- `1-4`: Jump to specific tab (Runners, Logs, Config, System)
76+
- `q`: Quit (or go back from logs view)
77+
- `Ctrl+C`: Force quit
78+
79+
### Runners View
80+
- `↑/↓`: Navigate runner list
81+
- `Enter`: View logs for selected runner
82+
- `r`: Refresh runner list
83+
84+
### Logs View
85+
- `↑/↓` / `PgUp/PgDn`: Scroll logs
86+
- `g` / `G`: Go to top/bottom
87+
- `a`: Toggle auto-scroll
88+
- `c`: Clear logs
89+
- `r`: Refresh logs
90+
91+
### Config View
92+
- `Tab`: Navigate between fields
93+
- `Ctrl+S`: Save configuration
94+
- `r`: Edit runner-specific settings
95+
- `↑/↓`: Select different runner (in runner edit mode)
96+
- `Esc`: Exit runner edit mode
97+
98+
### System View
99+
- `r`: Refresh system status
100+
- `s`: Restart GitLab Runner service
101+
102+
## Configuration
103+
104+
The tool reads and modifies the standard GitLab Runner configuration file (usually `/etc/gitlab-runner/config.toml`).
105+
106+
### Editable Settings
107+
108+
**Global:**
109+
- Concurrent job limit
110+
- Check interval
111+
- Log level
112+
113+
**Per-Runner:**
114+
- Job limit
115+
- Max concurrent builds
116+
- Tags
117+
- Run untagged jobs
118+
- Locked status
119+
120+
## Security Considerations
121+
122+
- The tool requires read/write access to the GitLab Runner configuration
123+
- Service management commands may require sudo privileges
124+
- Runner tokens are displayed but can be masked in future versions
125+
126+
## Building from Source
127+
128+
```bash
129+
# Get dependencies
130+
go mod download
131+
132+
# Build
133+
go build -o gitlab-runner-tui cmd/gitlab-runner-tui/main.go
134+
135+
# Run tests (if available)
136+
go test ./...
137+
```
138+
139+
## License
140+
141+
MIT License - See LICENSE file for details
142+
143+
## Contributing
144+
145+
Contributions are welcome! Please feel free to submit a Pull Request.

example-config.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
concurrent = 4
2+
check_interval = 3
3+
log_level = "info"
4+
log_format = "runner"
5+
6+
[session_server]
7+
session_timeout = 1800
8+
9+
[[runners]]
10+
name = "example-docker-runner"
11+
url = "https://gitlab.example.com"
12+
token = "example-token-123"
13+
executor = "docker"
14+
limit = 2
15+
output_limit = 4096
16+
request_concurrency = 1
17+
18+
[runners.docker]
19+
image = "alpine:latest"
20+
privileged = false
21+
disable_entrypoint_overwrite = false
22+
oom_kill_disable = false
23+
disable_cache = false
24+
volumes = ["/cache"]
25+
shm_size = 0
26+
27+
[[runners]]
28+
name = "example-shell-runner"
29+
url = "https://gitlab.example.com"
30+
token = "example-token-456"
31+
executor = "shell"
32+
shell = "bash"
33+
limit = 1

go.mod

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module github.com/larkin/gitlab-runner-tui
2+
3+
go 1.24.3
4+
5+
require (
6+
github.com/BurntSushi/toml v1.5.0
7+
github.com/charmbracelet/bubbles v0.21.0
8+
github.com/charmbracelet/bubbletea v1.3.5
9+
github.com/charmbracelet/lipgloss v1.1.0
10+
gopkg.in/yaml.v3 v3.0.1
11+
)
12+
13+
require (
14+
github.com/atotto/clipboard v0.1.4 // indirect
15+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
16+
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
17+
github.com/charmbracelet/harmonica v0.2.0 // indirect
18+
github.com/charmbracelet/x/ansi v0.8.0 // indirect
19+
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
20+
github.com/charmbracelet/x/term v0.2.1 // indirect
21+
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
22+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
23+
github.com/mattn/go-isatty v0.0.20 // indirect
24+
github.com/mattn/go-localereader v0.0.1 // indirect
25+
github.com/mattn/go-runewidth v0.0.16 // indirect
26+
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
27+
github.com/muesli/cancelreader v0.2.2 // indirect
28+
github.com/muesli/termenv v0.16.0 // indirect
29+
github.com/rivo/uniseg v0.4.7 // indirect
30+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
31+
golang.org/x/sync v0.13.0 // indirect
32+
golang.org/x/sys v0.32.0 // indirect
33+
golang.org/x/text v0.3.8 // indirect
34+
)

0 commit comments

Comments
 (0)