Skip to content

Commit 7e5c79f

Browse files
shaygunsinadarbouyclaude
committed
NodeRings CLI (nr).
Command-line tool for registering and managing provider clusters on NodeRings: cluster register and deregister, operator install and upgrade, service accounts, metrics credentials, and diagnostics. Co-authored-by: Sina Darbouy <sinadarbouy@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0 parents  commit 7e5c79f

165 files changed

Lines changed: 35486 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: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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: Check generated API client for internal details
34+
run: ./scripts/openapi-leak-check.sh
35+
36+
- name: Vet
37+
run: go vet ./...
38+
39+
- name: Test
40+
run: go test -race -count=1 ./...
41+
42+
- name: Coverage
43+
run: |
44+
mkdir -p build
45+
go test -coverprofile=build/coverage.out -covermode=atomic $(go list ./... | grep -v '/internal/api/generated')
46+
go tool cover -func=build/coverage.out | tee build/coverage.txt
47+
TOTAL=$(go tool cover -func=build/coverage.out | awk '/total:/ {print $3}' | tr -d '%')
48+
echo "Total coverage: ${TOTAL}%"
49+
# Soft floor — raise over time (plan: start ~25–30%)
50+
awk -v t="$TOTAL" 'BEGIN { if (t+0 < 15) { print "Coverage below soft floor (15%)"; exit 1 } }'
51+
52+
lint:
53+
name: Lint
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: read
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
61+
- name: Set up Go
62+
uses: actions/setup-go@v5
63+
with:
64+
go-version-file: go.mod
65+
cache: true
66+
67+
- name: golangci-lint
68+
uses: golangci/golangci-lint-action@v7
69+
with:
70+
version: v2.15.0
71+
args: --timeout=5m
72+
73+
vuln:
74+
name: Vulnerability
75+
runs-on: ubuntu-latest
76+
permissions:
77+
contents: read
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v4
81+
82+
- name: Set up Go
83+
uses: actions/setup-go@v5
84+
with:
85+
go-version-file: go.mod
86+
cache: true
87+
88+
- name: Install govulncheck
89+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
90+
91+
- name: Run govulncheck
92+
run: govulncheck ./...

‎.github/workflows/release.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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: Install syft
27+
uses: anchore/sbom-action/download-syft@v0
28+
29+
- name: Run GoReleaser
30+
uses: goreleaser/goreleaser-action@v6
31+
with:
32+
distribution: goreleaser
33+
version: "~> v2"
34+
args: release --clean
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.gitignore‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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/
54+
55+
# Graphify output stays local. It indexes every file, so committing it can
56+
# publish code and names that are not part of this repository's public surface.
57+
graphify-out/

‎.golangci.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
gosec:
18+
excludes:
19+
- G204 # subprocess with variable is expected for install tooling
20+
- G304 # file path from config is intentional
21+
- G702 # taint analysis alias of G204 (exec.CommandContext)
22+
- G703 # taint analysis alias of G304 (os.Stat / WriteFile paths)
23+
misspell:
24+
locale: US
25+
exclusions:
26+
paths:
27+
- internal/api/generated
28+
rules:
29+
- path: _test\.go
30+
linters:
31+
- gosec
32+
- errcheck
33+
34+
formatters:
35+
enable:
36+
- gofmt
37+
- goimports
38+
settings:
39+
goimports:
40+
local-prefixes:
41+
- github.com/noderings/cli
42+
exclusions:
43+
paths:
44+
- 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"

0 commit comments

Comments
 (0)