Skip to content

Commit 4e568be

Browse files
authored
feat: add a chart for the network mapper (#5)
## Summary by Sourcery Add a new network-bootstrapper Helm chart and introduce an automated versioning script, integrating version updates into the CI pipeline. New Features: - Introduce a Helm chart for network-bootstrapper with values and templates for deployment, service, ingress, HTTPRoute, HPA, service account, and test hook - Add tools/version.ts script to compute and apply package and chart versions based on Git ref metadata Enhancements: - Add yaml dependency for parsing and writing Chart.yaml files CI: - Insert a CI step to run the versioning script (bun run tools/version.ts) during pull_request and push builds
1 parent 6cb848b commit 4e568be

27 files changed

Lines changed: 1694 additions & 123 deletions

.github/ct.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
chart-dirs:
2+
- charts
3+
remote: origin
4+
target-branch: main

.github/renovate.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
44
"config:recommended",
5+
"helpers:pinGitHubActionDigests",
56
":automergeMinor",
67
":automergePr",
78
":automergeRequireAllStatusChecks",

.github/workflows/qa.yml

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ jobs:
6060
SLACK_CHANNEL_ID: op://platform/slack-bot/SLACK_CHANNEL_ID
6161
HARBOR_USER: op://platform/harbor/username
6262
HARBOR_PASS: op://platform/harbor/password
63-
PAT_TOKEN: op://platform/github-commit-pat/credential
64-
NPM_TOKEN: op://platform/npmjs/credential
6563

6664
# Label QA as running and notify Slack (only for non-draft PRs)
6765
- name: Label QA as running
@@ -120,6 +118,15 @@ jobs:
120118
if: github.event_name == 'pull_request' || github.event_name == 'push'
121119
run: bun typecheck
122120

121+
- name: Set version
122+
id: version
123+
if: github.event_name == 'pull_request' || github.event_name == 'push'
124+
run: bun run tools/version.ts
125+
126+
- name: Run docs
127+
if: github.event_name == 'pull_request' || github.event_name == 'push'
128+
run: bun run docs:helm
129+
123130
- name: Docker meta
124131
if: github.event_name == 'pull_request' || github.event_name == 'push'
125132
id: meta
@@ -135,6 +142,7 @@ jobs:
135142
type=semver,pattern={{major}}.{{minor}}
136143
type=semver,pattern={{major}}
137144
type=sha
145+
type=raw,value=${{ steps.version.outputs.version }}
138146
139147
- name: Build and push
140148
if: github.event_name == 'pull_request' || github.event_name == 'push'
@@ -148,6 +156,52 @@ jobs:
148156
provenance: mode=max
149157
sbom: true
150158

159+
- name: Set up Python
160+
if: github.event_name == 'pull_request' || github.event_name == 'push'
161+
uses: actions/setup-python@v5
162+
with:
163+
python-version: "3.x"
164+
check-latest: true
165+
166+
- name: Set up Helm
167+
if: github.event_name == 'pull_request' || github.event_name == 'push'
168+
uses: azure/setup-helm@v4
169+
170+
- name: Set up chart-testing
171+
if: github.event_name == 'pull_request' || github.event_name == 'push'
172+
uses: helm/chart-testing-action@v2.7.0
173+
174+
- name: Determine chart changes
175+
if: github.event_name == 'pull_request' || github.event_name == 'push'
176+
id: ct-changed
177+
env:
178+
CT_CONFIG: .github/ct.yaml
179+
run: |
180+
changed=$(ct list-changed --config "$CT_CONFIG")
181+
if [[ -n "$changed" ]]; then
182+
printf "changed=true\n" >> "$GITHUB_OUTPUT"
183+
echo "$changed"
184+
else
185+
printf "changed=false\n" >> "$GITHUB_OUTPUT"
186+
echo "No chart changes detected"
187+
fi
188+
189+
- name: Run chart-testing (lint)
190+
if: (github.event_name == 'pull_request' || github.event_name == 'push') && steps.ct-changed.outputs.changed == 'true'
191+
env:
192+
CT_CONFIG: .github/ct.yaml
193+
run: ct lint --config "$CT_CONFIG" --validate-yaml=false
194+
195+
- name: Create kind cluster
196+
if: (github.event_name == 'pull_request' || github.event_name == 'push') && steps.ct-changed.outputs.changed == 'true'
197+
uses: helm/kind-action@v1.12.0
198+
199+
- name: Run chart-testing (install)
200+
if: (github.event_name == 'pull_request' || github.event_name == 'push') && steps.ct-changed.outputs.changed == 'true'
201+
env:
202+
CT_CONFIG: .github/ct.yaml
203+
run: ct install --config "$CT_CONFIG" --skip-clean-up
204+
151205
# Label QA results (PR only)
152206
- name: Label QA build status
153207
if: |
@@ -195,7 +249,27 @@ jobs:
195249
${{ steps.secret-scan.outcome == 'success' && 'success' || 'failure'
196250
}}
197251

198-
# Skip redundant notification - handled by consolidated step at the end
252+
- name: Login to Harbor
253+
if: |
254+
github.event_name == 'push' ||
255+
(github.event_name == 'pull_request' && github.event.pull_request.draft == false)
256+
uses: docker/login-action@v3
257+
with:
258+
registry: harbor.settlemint.com
259+
username: ${{ env.HARBOR_USER }}
260+
password: ${{ env.HARBOR_PASS }}
261+
262+
- name: Package chart
263+
if: |
264+
github.event_name == 'push' ||
265+
(github.event_name == 'pull_request' && github.event.pull_request.draft == false)
266+
run: bun run package:pack
267+
268+
- name: Push chart to Harbor
269+
if: |
270+
github.event_name == 'push' ||
271+
(github.event_name == 'pull_request' && github.event.pull_request.draft == false)
272+
run: bun run package:push:harbor
199273

200274
# Check PR review status (PR and PR review events only)
201275
- name: Check PR review status

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The TypeScript sources live in `src/`. CLI flows under `src/cli/` orchestrate pr
66

77
## Build, Test, and Development Commands
88

9-
Install dependencies with `bun install`. Use `bun run src/index.ts` to execute the bootstrapper locally. Run the full test suite with `bun test`. Type safety is enforced by `bun run typecheck`, and formatting plus lint rules are auto-fixed with `bun run check` (Biome). Combine these commands before pushing to catch regressions early.
9+
Install dependencies with `bun install`. Use `bun run src/index.ts` to execute the bootstrapper locally. Run the full test suite with `bun test`. Type safety is enforced by `bun run typecheck`, and formatting plus lint rules are auto-fixed with `bun run check:fix` (Biome). Combine these commands before pushing to catch regressions early.
1010

1111
## Coding Style & Naming Conventions
1212

README.md

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
# network-bootstrapper
22

3-
To install dependencies:
3+
Generate node identities, configure consensus, and emit a Besu genesis.
44

5-
```bash
6-
bun install
7-
```
5+
## Helm chart
6+
7+
The helm chart to run this on Kubernetes / OpenShift can be found [here](./charts/network-bootstrapper/README.md)
88

9-
To run:
9+
## CLI usage
1010

11-
```bash
12-
bun run src/index.ts
1311
```
12+
Usage: network-bootstrapper [options]
1413
15-
This project was created using `bun init` in bun v1.2.22. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
14+
Generate node identities, configure consensus, and emit a Besu genesis.
15+
16+
Options:
17+
-v, --validators <count> Number of validator nodes to generate.
18+
(default: 4)
19+
-r, --rpc-nodes <count> Number of RPC nodes to generate. (default: 2)
20+
-a, --allocations <file> Path to a genesis allocations JSON file.
21+
(default: none)
22+
-o, --outputType <type> Output target (screen, file, kubernetes).
23+
(default: "screen")
24+
--consensus <algorithm> Consensus algorithm (IBFTv2, QBFT). (default:
25+
QBFT)
26+
--chain-id <number> Chain ID for the genesis config. (default:
27+
random between 40000 and 50000)
28+
--seconds-per-block <number> Block time in seconds. (default: 2)
29+
--gas-limit <decimal> Block gas limit in decimal form. (default:
30+
9007199254740991)
31+
--gas-price <number> Base gas price (wei). (default: 0)
32+
--evm-stack-size <number> EVM stack size limit. (default: 2048)
33+
--contract-size-limit <number> Contract size limit in bytes. (default:
34+
2147483647)
35+
--accept-defaults Accept default values for all prompts when CLI
36+
flags are omitted. (default: disabled)
37+
-h, --help display help for command
38+
```

README.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# network-bootstrapper
2+
3+
Generate node identities, configure consensus, and emit a Besu genesis.
4+
5+
## Helm chart
6+
7+
The helm chart to run this on Kubernetes / OpenShift can be found [here](./charts/network-bootstrapper/README.md)
8+
9+
## CLI usage

biome.jsonc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"rules": {
66
"suspicious": {
77
"noConsole": "off"
8+
},
9+
"complexity": {
10+
"noExcessiveCognitiveComplexity": "off"
11+
},
12+
"nursery": {
13+
"useMaxParams": "off"
814
}
915
}
1016
},

bun.lock

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: network-bootstrapper
3+
description: A Helm chart for Kubernetes
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
maintainers:
8+
- name: SettleMint
9+
email: support@settlemint.com
10+
url: https://settlemint.com

0 commit comments

Comments
 (0)