Skip to content

Commit 3566041

Browse files
chore: update golang to 1.26 and GHA to latest versions (#622)
- Update go.mod to go 1.26 - Update dependencies and go.sum - Update GitHub Actions to latest stable majors: - actions/checkout@v6 - actions/setup-go@v6 - actions/upload-artifact@v7 - actions/download-artifact@v7 - hashicorp/setup-terraform@v4 - softprops/action-gh-release@v2 - Re-apply version/commit injection via ldflags (GHA and local) - added Claude.md - included a script that could be used to validate GH checksums Signed-off-by: James Nesbitt <jnesbitt@mirantis.com>
1 parent 4ec78f4 commit 3566041

11 files changed

Lines changed: 401 additions & 240 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919

2020
steps:
2121
- name: Checkout code
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2323

2424
- name: Set up Go
25-
uses: actions/setup-go@v5
25+
uses: actions/setup-go@v6
2626
with:
2727
go-version-file: go.mod
2828
cache: true
@@ -43,7 +43,7 @@ jobs:
4343
done
4444
4545
- name: Upload artifacts
46-
uses: actions/upload-artifact@v4
46+
uses: actions/upload-artifact@v7
4747
with:
4848
name: launchpad-binaries
4949
path: dist/
@@ -57,10 +57,10 @@ jobs:
5757
needs: build
5858
steps:
5959
- name: Checkout code
60-
uses: actions/checkout@v4
60+
uses: actions/checkout@v6
6161

6262
- name: Set up Go
63-
uses: actions/setup-go@v5
63+
uses: actions/setup-go@v6
6464
with:
6565
go-version-file: go.mod
6666
cache: true

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919

2020

2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v6
2323

2424
- name: Set up Go
25-
uses: actions/setup-go@v5
25+
uses: actions/setup-go@v6
2626
with:
2727
go-version-file: go.mod
2828

.github/workflows/pr.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030

3131
steps:
3232
- name: Checkout code
33-
uses: actions/checkout@v4
33+
uses: actions/checkout@v6
3434

3535
- name: Set up Go
36-
uses: actions/setup-go@v5
36+
uses: actions/setup-go@v6
3737
with:
3838
go-version-file: go.mod
3939
cache: true
@@ -49,10 +49,10 @@ jobs:
4949

5050
steps:
5151
- name: Checkout code
52-
uses: actions/checkout@v4
52+
uses: actions/checkout@v6
5353

5454
- name: Set up Go
55-
uses: actions/setup-go@v5
55+
uses: actions/setup-go@v6
5656
with:
5757
go-version-file: go.mod
5858
cache: true
@@ -68,10 +68,10 @@ jobs:
6868

6969
steps:
7070
- name: Checkout code
71-
uses: actions/checkout@v4
71+
uses: actions/checkout@v6
7272

7373
- name: Set up Go
74-
uses: actions/setup-go@v5
74+
uses: actions/setup-go@v6
7575
with:
7676
go-version-file: go.mod
7777
cache: true
@@ -89,10 +89,10 @@ jobs:
8989

9090
steps:
9191
- name: Checkout code
92-
uses: actions/checkout@v4
92+
uses: actions/checkout@v6
9393

9494
- name: Set up Go
95-
uses: actions/setup-go@v5
95+
uses: actions/setup-go@v6
9696
with:
9797
go-version-file: go.mod
9898
cache: true

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v6
2424

2525
- name: Set up Go
26-
uses: actions/setup-go@v5
26+
uses: actions/setup-go@v6
2727
with:
2828
go-version-file: go.mod
2929

@@ -48,7 +48,7 @@ jobs:
4848
sha256sum launchpad_* > checksums.sha256
4949
5050
- name: Upload artifacts
51-
uses: actions/upload-artifact@v4
51+
uses: actions/upload-artifact@v7
5252
with:
5353
name: launchpad-release-binaries
5454
path: dist/
@@ -61,13 +61,13 @@ jobs:
6161
contents: write
6262
steps:
6363
- name: Download binaries
64-
uses: actions/download-artifact@v4
64+
uses: actions/download-artifact@v7
6565
with:
6666
name: launchpad-release-binaries
6767
path: dist/
6868

6969
- name: Create GitHub Release
70-
uses: softprops/action-gh-release@v1
70+
uses: softprops/action-gh-release@v2
7171
with:
7272
files: dist/*
7373
generate_release_notes: true

.github/workflows/smoke-test-full.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Checkout code
2020
uses: actions/checkout@v6
2121
- name: Setup Terraform
22-
uses: hashicorp/setup-terraform@v3
22+
uses: hashicorp/setup-terraform@v4
2323
- name: Run full Smoke Tests
2424
env:
2525
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

.github/workflows/smoke-test-small.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Checkout code
1818
uses: actions/checkout@v6
1919
- name: Setup Terraform
20-
uses: hashicorp/setup-terraform@v3
20+
uses: hashicorp/setup-terraform@v4
2121
- name: Run small Smoke Tests
2222
env:
2323
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

CLAUDE.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
Mirantis Launchpad is a CLI tool that installs, upgrades, and resets Mirantis Kubernetes Engine (MKE) and Mirantis Container Runtime (MCR) clusters on provisioned compute nodes. It is **stateless** between runs — all cluster state is discovered by querying hosts directly.
8+
9+
## Agent Rules (from AI_AGENTS.md)
10+
11+
- **NEVER** work on, push to, or merge into `main`. All work goes on feature branches.
12+
- **All commits MUST be signed** (`git commit -s`).
13+
- Use `GOTOOLCHAIN=auto` for all `go` commands (already set in Makefile via `export`).
14+
- Read `docs/guidance/project.md` before implementing features or bug fixes.
15+
16+
## Commands
17+
18+
```bash
19+
# Build
20+
make local # Build for current platform → dist/launchpad_GOOS_GOARCH
21+
22+
# Lint & security
23+
make lint # golangci-lint run
24+
make security-scan # govulncheck ./...
25+
26+
# Tests
27+
make unit-test # go test -v --tags 'testing' ./pkg/...
28+
make functional-test # go test -v ./test/functional/... -timeout 20m
29+
make integration-test # go test -v ./test/integration/... -timeout 20m
30+
make smoke-small # E2E small cluster (20m timeout)
31+
make smoke-full # E2E full matrix cluster (50m timeout)
32+
33+
# Run a single test package
34+
go test -v --tags 'testing' ./pkg/config/...
35+
36+
# Run a single test
37+
go test -v --tags 'testing' ./pkg/config/... -run TestFoo
38+
```
39+
40+
The build tag `testing` is required for unit tests in `pkg/`.
41+
42+
## Architecture: Phase Manager Pattern
43+
44+
All major operations (apply, reset, describe) are implemented as ordered sequences of **phases** executed by a `phase.Manager`. This is the central architectural pattern — new features should be implemented as new phases or additions to existing ones.
45+
46+
```
47+
cmd/apply.go
48+
└── product/mke/mke.go (Apply method)
49+
└── phase.Manager.Run()
50+
└── [Phase1, Phase2, ..., PhaseN] executed sequentially
51+
```
52+
53+
Each phase implements:
54+
- `Run() error` — required
55+
- `Title() string` — required
56+
- Optional: `Prepare(config)`, `ShouldRun()`, `CleanUp()`, `DisableCleanup()`
57+
58+
**Key packages:**
59+
60+
| Package | Role |
61+
|---|---|
62+
| `pkg/phase/` | Phase Manager orchestration |
63+
| `pkg/product/mke/` | MKE apply/reset/describe logic |
64+
| `pkg/product/mke/phase/` | 30+ phase implementations |
65+
| `pkg/product/mke/config/` | MKE-specific config structs |
66+
| `pkg/config/` | YAML config parsing, schema migrations (v1–v15) |
67+
| `pkg/configurer/` | OS/distro-specific host configuration |
68+
| `pkg/kubeclient/` | Kubernetes client operations |
69+
| `pkg/helm/` | Helm chart management |
70+
| `pkg/docker/` | Docker image handling and auth |
71+
| `pkg/analytics/` | Segment telemetry |
72+
73+
## Configuration
74+
75+
- Default config file: `launchpad.yaml` (override with `--config`)
76+
- Supports `--config -` to read from stdin
77+
- Environment variable substitution via `envsubst`
78+
- Schema migrations live in `pkg/config/migration/` — required for any config struct changes
79+
- Config migrations must be backward compatible; each migration version has unit tests
80+
81+
## Host Management
82+
83+
Hosts are managed via [k0sproject/rig](https://github.com/k0sproject/rig), which abstracts SSH (Linux) and WinRM (Windows) connections. Phases receive a configured host set and use rig for remote command execution, file upload/download, and shell quoting.
84+
85+
## Testing Strategy
86+
87+
| Type | Location | Notes |
88+
|---|---|---|
89+
| Unit | `pkg/**/*_test.go` | Requires `--tags 'testing'` build tag |
90+
| Functional | `test/functional/` | Component-level, may need network |
91+
| Integration | `test/integration/` | Requires real provisioned nodes |
92+
| Smoke | `test/smoke/` | Full E2E via Terraform (terratest) |
93+
94+
## Linting
95+
96+
`.golangci.yml` enables 30+ linters. Notable constraints:
97+
- `varnamelen`: max 10 chars (allowlist includes `i`, `h`, `ok`, `id`, etc.)
98+
- Package names may conflict with stdlib (log, version, user, constant) — these are excluded from the relevant linter
99+
- Generated files (`*.gen.go`) are excluded
100+
101+
## Documentation
102+
103+
Consult these before implementing non-trivial changes:
104+
- `docs/guidance/project.md` — core architectural principles
105+
- `docs/specifications/architecture.md` — Phase Manager and design decisions
106+
- `docs/development/workflow.md` — contribution and testing workflow
107+
- `docs/requirements/` — PRDs for planned features

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ clean:
1515
local:
1616
mkdir -p dist
1717
GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) \
18+
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo 0.0.0) \
19+
COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo HEAD) \
1820
output_name="dist/launchpad_$${GOOS}_$${GOARCH}"; \
1921
if [ "$${GOOS}" = "windows" ]; then \
2022
output_name="$${output_name}.exe"; \
2123
fi; \
22-
go build -o "$${output_name}" ./main.go && \
23-
./$${output_name} --help
24+
go build \
25+
-ldflags "-X github.com/Mirantis/launchpad/version.Version=$${VERSION} -X github.com/Mirantis/launchpad/version.GitCommit=$${COMMIT}" \
26+
-o "$${output_name}" ./main.go && \
27+
./$${output_name} version
2428

2529
# run linting
2630
.PHONY: lint

0 commit comments

Comments
 (0)