Skip to content

Commit b1bf622

Browse files
committed
Version 1.
0 parents  commit b1bf622

132 files changed

Lines changed: 111314 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.editorconfig‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = tab
9+
indent_size = 4
10+
11+
[*.{yml,yaml,md,json}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[Makefile]
16+
indent_style = tab

‎.github/workflows/ci.yml‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
test:
16+
name: Test
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version-file: go.mod
28+
cache: true
29+
30+
- name: Download modules
31+
run: go mod download
32+
33+
- name: Vet
34+
run: go vet ./...
35+
36+
- name: Test
37+
run: go test -race -count=1 ./...
38+
39+
- name: Coverage
40+
run: |
41+
mkdir -p build
42+
go test -coverprofile=build/coverage.out -covermode=atomic $(go list ./... | grep -v '/internal/api/generated')
43+
go tool cover -func=build/coverage.out | tee build/coverage.txt
44+
TOTAL=$(go tool cover -func=build/coverage.out | awk '/total:/ {print $3}' | tr -d '%')
45+
echo "Total coverage: ${TOTAL}%"
46+
# Soft floor — raise over time (plan: start ~25–30%)
47+
awk -v t="$TOTAL" 'BEGIN { if (t+0 < 15) { print "Coverage below soft floor (15%)"; exit 1 } }'
48+
49+
lint:
50+
name: Lint
51+
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
58+
- name: Set up Go
59+
uses: actions/setup-go@v5
60+
with:
61+
go-version-file: go.mod
62+
cache: true
63+
64+
- name: golangci-lint
65+
uses: golangci/golangci-lint-action@v7
66+
with:
67+
version: v2.1.6
68+
args: --timeout=5m
69+
70+
vuln:
71+
name: Vulnerability
72+
runs-on: ubuntu-latest
73+
permissions:
74+
contents: read
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v4
78+
79+
- name: Set up Go
80+
uses: actions/setup-go@v5
81+
with:
82+
go-version-file: go.mod
83+
cache: true
84+
85+
- name: Install govulncheck
86+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
87+
88+
- name: Run govulncheck
89+
run: govulncheck ./...

‎.github/workflows/release.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
goreleaser:
12+
name: 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-file: go.mod
24+
cache: true
25+
26+
- name: Run GoReleaser
27+
uses: goreleaser/goreleaser-action@v6
28+
with:
29+
distribution: goreleaser
30+
version: "~> v2"
31+
args: release --clean
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.gitignore‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Binaries
2+
/build/
3+
/dist/
4+
*.exe
5+
*.exe~
6+
*.dll
7+
*.so
8+
*.dylib
9+
/nr
10+
/nr-cli
11+
/nr-linux
12+
/nr_linux_amd64
13+
/nr_linux_arm64
14+
/nr_darwin
15+
/nr.exe
16+
/build/nr
17+
/build/nr_*
18+
/build/*.exe
19+
20+
# Test binary, built with `go test -c`
21+
*.test
22+
23+
# Output of the go coverage tool
24+
*.out
25+
coverage.html
26+
27+
# Dependency directories
28+
vendor/
29+
30+
# Go workspace file
31+
go.work
32+
33+
# IDE
34+
.idea/
35+
.vscode/
36+
.cursor/
37+
*.swp
38+
*.swo
39+
*~
40+
41+
# OS
42+
.DS_Store
43+
Thumbs.db
44+
45+
# Config (user-specific)
46+
~/.nr/
47+
48+
# Logs
49+
*.log
50+
51+
# Temporary files
52+
tmp/
53+
temp/

‎.golangci.yml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: "2"
2+
3+
run:
4+
tests: true
5+
6+
linters:
7+
default: none
8+
enable:
9+
- errcheck
10+
- govet
11+
- ineffassign
12+
- staticcheck
13+
- unused
14+
- misspell
15+
- gosec
16+
settings:
17+
goimports:
18+
local-prefixes:
19+
- github.com/noderings/cli
20+
gosec:
21+
excludes:
22+
- G204 # subprocess with variable is expected for install tooling
23+
- G304 # file path from config is intentional
24+
misspell:
25+
locale: US
26+
exclusions:
27+
paths:
28+
- internal/api/generated
29+
rules:
30+
- path: _test\.go
31+
linters:
32+
- gosec
33+
- errcheck
34+
35+
formatters:
36+
enable:
37+
- gofmt
38+
- goimports
39+
settings:
40+
goimports:
41+
local-prefixes:
42+
- github.com/noderings/cli
43+
exclusions:
44+
paths:
45+
- internal/api/generated

‎.goreleaser.yaml‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
version: 2
2+
3+
project_name: nr
4+
5+
before:
6+
hooks:
7+
- go mod tidy
8+
9+
builds:
10+
- id: nr
11+
main: ./cmd/nr
12+
binary: nr
13+
env:
14+
- CGO_ENABLED=0
15+
goos:
16+
- linux
17+
- darwin
18+
- windows
19+
goarch:
20+
- amd64
21+
- arm64
22+
ignore:
23+
- goos: windows
24+
goarch: arm64
25+
ldflags:
26+
- -s -w
27+
- -X github.com/noderings/cli/internal/cli.version={{.Version}}
28+
- -X github.com/noderings/cli/internal/cli.commit={{.Commit}}
29+
- -X github.com/noderings/cli/internal/cli.buildDate={{.Date}}
30+
31+
archives:
32+
- id: nr
33+
formats: [tar.gz]
34+
format_overrides:
35+
- goos: windows
36+
formats: [zip]
37+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
38+
files:
39+
- LICENSE
40+
- README.md
41+
- CHANGELOG.md
42+
43+
checksum:
44+
name_template: checksums.txt
45+
algorithm: sha256
46+
47+
changelog:
48+
sort: asc
49+
filters:
50+
exclude:
51+
- "^docs:"
52+
- "^test:"
53+
- "^ci:"
54+
- Merge pull request
55+
- Merge branch
56+
57+
sboms:
58+
- artifacts: archive
59+
60+
release:
61+
github:
62+
owner: noderings
63+
name: cli
64+
draft: false
65+
prerelease: auto
66+
name_template: "v{{.Version}}"
67+
68+
snapshot:
69+
version_template: "{{ incpatch .Version }}-next"

‎CHANGELOG.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changelog
2+
3+
All notable changes to this project are documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- `nr` CLI for provider authentication, agents, service accounts, and cluster registration
13+
- `nr cluster register` with Proxmox, VirtFusion, and SolusVM 2 hypervisor drivers
14+
- Checkpoint/resume, verify, status, health, logs, debug, and deregister
15+
- GitHub Release installer (`scripts/install.sh`) and GoReleaser multi-arch binaries
16+
17+
## [0.1.0] - TBD
18+
19+
Initial public release.

‎CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @noderings/maintainers

‎CONTRIBUTING.md‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Contributing
2+
3+
Thanks for your interest in the NodeRings CLI (`nr`).
4+
5+
## Development setup
6+
7+
```bash
8+
git clone https://github.com/noderings/cli.git
9+
cd cli
10+
go mod download
11+
make build
12+
make test
13+
```
14+
15+
Requirements:
16+
17+
- Go version matching `go.mod`
18+
- Make
19+
- Optional: [golangci-lint](https://golangci-lint.run/), `govulncheck`
20+
21+
## Before opening a pull request
22+
23+
```bash
24+
make fmt
25+
make vet
26+
make lint
27+
make test
28+
make vuln
29+
```
30+
31+
Do not edit generated files under `internal/api/generated/` by hand.
32+
33+
## Code style
34+
35+
- Go, with packages under `internal/`
36+
- Prefer small, focused commits and PRs
37+
- Handle errors; do not ignore with `_`
38+
- Do not commit secrets, tokens, kubeconfigs, or hypervisor instances files
39+
40+
## Pull requests
41+
42+
- Describe the problem and approach
43+
- Ensure CI passes (tests, lint, govulncheck)
44+
- Update the README or `docs/` when user-facing behavior changes
45+
46+
## License
47+
48+
By contributing, you agree that your contributions are licensed under the [Apache License 2.0](LICENSE).

0 commit comments

Comments
 (0)