Skip to content

Commit a8651b4

Browse files
committed
Cleanup
1 parent 2900ebe commit a8651b4

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

Makefile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@ ENV := $(shell cat ../../.last_used_env || echo "not-set")
33

44
.PHONY: build
55
build:
6-
@versions_json=$$(./scripts/parse-versions-with-hash.sh firecracker_versions.txt); \
7-
echo "$$versions_json" | jq -r '.[] | "\(.version)|\(.hash)|\(.version_name)"' | \
8-
while IFS='|' read -r version hash version_name; do \
9-
echo "Building $$version_name..."; \
10-
./build.sh "$$version" "$$hash" "$$version_name"; \
11-
done
6+
@if ! git diff-index --quiet HEAD --; then \
7+
echo "Error: Uncommitted changes detected. Please commit or stash changes before building." >&2; \
8+
exit 1; \
9+
fi
10+
@hash=$$(git rev-parse HEAD); \
11+
tag=$$(git describe --tags --abbrev=0 HEAD 2>/dev/null || echo ""); \
12+
if [ -z "$$tag" ]; then \
13+
echo "Error: No tag found for current commit" >&2; \
14+
exit 1; \
15+
fi; \
16+
short_hash=$$(git rev-parse --short HEAD); \
17+
version_name="$${tag}_$${short_hash}"; \
18+
./build.sh "$$tag" "$$hash" "$$version_name"
1219

1320
.PHONY: upload
1421
upload:

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,45 @@
22

33
## Overview
44

5-
This project automates the building of custom Firecracker. It supports building specific firecracker versions and uploading the resulting binaries to a Google Cloud Storage (GCS) bucket.
5+
This project automates the building of custom Firecracker versions. It supports building specific firecracker versions and uploading the resulting binaries to a Google Cloud Storage (GCS) bucket.
66

77
## Prerequisites
88

99
- Linux environment (for building firecracker)
10+
- Git repository with tags
1011

1112
## Building Firecrackers
1213

13-
1. **Configure firecracker versions:**
14-
- Edit `firecracker_versions.txt` to specify which firecracker versions to build (one per line, e.g., `<last_tag-prelease>-<first-8-letters-of-the-specific-commit>`).
14+
### Local Build
1515

16-
2. **Build:**
16+
Build the current git version (latest tag + commit hash):
1717

18-
```sh
19-
make build
20-
```
18+
```sh
19+
make build
20+
```
2121

22-
The built firecrackers will be placed in `builds/<version_name>/firecracker`.
22+
**Requirements:**
23+
- The repository must be in a clean state (no uncommitted changes)
24+
- The current commit must have an associated tag
25+
- The built firecracker will be placed in `builds/<tag>_<shorthash>/firecracker`
2326

24-
## Development Workflow
27+
### CI/CD Build
2528

26-
- On every push, GitHub Actions will automatically build the firecrackers and save it as an artifact.
29+
The `firecracker_versions.txt` file specifies which versions to build in CI/CD:
30+
31+
- Edit `firecracker_versions.txt` to specify firecracker versions (one per line)
32+
- Versions can be tags (e.g., `v1.10.1`) or tag with shorthash (e.g., `v1.12.1_abcdef12`)
33+
- On every push, GitHub Actions will automatically:
34+
1. Parse versions from `firecracker_versions.txt` and resolve commit hashes
35+
2. Build each version in parallel
36+
3. Check CI status for each version
37+
4. Upload successful builds to GCS and create GitHub releases (on main branch)
38+
39+
## Scripts
40+
41+
- `build.sh <version> <hash> <version_name>` - Builds a single Firecracker version
42+
- `scripts/parse-versions-with-hash.sh` - Parses versions and resolves commit hashes
43+
- `scripts/check-fc-ci.sh <versions_json>` - Checks CI status for parsed versions
2744

2845
## License
2946

0 commit comments

Comments
 (0)