Skip to content

Commit

Permalink
feat(experimental): Build multiple recipes in parallel (#182)
Browse files Browse the repository at this point in the history
The `build` subcommand can now take in any number of recipe files and
will build them all in parallel. Along with this new ability, I've added
a way to easily distinguish which part of the build log belongs to which
recipe. Check out the `docker_build` action of this PR for an example.


![gif](https://gitlab.com/wunker-bunker/wunker-os/-/raw/main/bluebuild.gif)

## Tasks

- [x] Make build log follow same pattern as normal logs to keep things
consistent
- [x] Update color ranges based on @xynydev 's feedback
- [x] Deal with ANSI control characters in log output
- [x] Add [`indicatif`](https://crates.io/crates/indicatif) to make logs
look nicer
- [x] Add ability to print logs to a file
  • Loading branch information
gmpinder authored Jun 7, 2024
1 parent 18e48a3 commit 4ca98c1
Show file tree
Hide file tree
Showing 24 changed files with 1,443 additions and 494 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:

env:
FORCE_COLOR: 1
CLICOLOR_FORCE: 1
RUST_LOG_STYLE: always

jobs:
arm64-prebuild:
Expand Down Expand Up @@ -203,7 +205,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
Expand All @@ -218,7 +220,7 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build --push -vv
bluebuild build --push -vv recipes/recipe.yml recipes/recipe-39.yml
docker-build-external-login:
timeout-minutes: 60
Expand Down Expand Up @@ -259,7 +261,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
Expand All @@ -273,7 +275,7 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build --push -vv
bluebuild build --push -vv recipes/recipe.yml recipes/recipe-39.yml
podman-build:
timeout-minutes: 60
Expand Down Expand Up @@ -314,7 +316,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Run Build
env:
Expand All @@ -325,7 +327,7 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build -B podman --push -vv
bluebuild build -B podman --push -vv recipes/recipe.yml recipes/recipe-39.yml
buildah-build:
timeout-minutes: 60
Expand Down Expand Up @@ -366,7 +368,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Run Build
env:
Expand All @@ -377,4 +379,4 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build -B buildah --push -vv
bluebuild build -B buildah --push -vv recipes/recipe.yml recipes/recipe-39.yml
18 changes: 10 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:

env:
FORCE_COLOR: 1
CLICOLOR_FORCE: 1
RUST_LOG_STYLE: always

jobs:
arm64-prebuild:
Expand Down Expand Up @@ -201,7 +203,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
Expand All @@ -216,7 +218,7 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build --push -vv
bluebuild build --push -vv recipes/recipe.yml recipes/recipe-39.yml
docker-build-external-login:
timeout-minutes: 60
Expand Down Expand Up @@ -257,7 +259,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
Expand All @@ -271,7 +273,7 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build --push -vv
bluebuild build --push -vv recipes/recipe.yml recipes/recipe-39.yml
podman-build:
timeout-minutes: 60
Expand Down Expand Up @@ -312,7 +314,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Run Build
env:
Expand All @@ -323,7 +325,7 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build -B podman --push -vv
bluebuild build -B podman --push -vv recipes/recipe.yml recipes/recipe-39.yml
buildah-build:
timeout-minutes: 60
Expand Down Expand Up @@ -364,7 +366,7 @@ jobs:

- name: Install bluebuild
run: |
cargo install --path . --debug
cargo install --path . --debug --all-features
- name: Run Build
env:
Expand All @@ -375,4 +377,4 @@ jobs:
cd integration-tests/test-repo
bluebuild template -vv | tee Containerfile
grep -q 'ARG IMAGE_REGISTRY=ghcr.io/blue-build' Containerfile || exit 1
bluebuild build -B buildah --push -vv
bluebuild build -B buildah --push -vv recipes/recipe.yml recipes/recipe-39.yml
2 changes: 1 addition & 1 deletion .rusty-hook.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[hooks]
pre-commit = "cargo fmt --check && cargo test --all-features && cargo clippy --all-features -- -D warnings"
pre-commit = "cargo fmt --check && cargo test && cargo test --all-features && cargo clippy -- -D warnings && cargo clippy --all-features -- -D warnings"

[logging]
verbose = true
Loading

0 comments on commit 4ca98c1

Please sign in to comment.