1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-08 06:45:32 +00:00
Commit graph

36 commits

Author SHA1 Message Date
Jason Hall
05a1a1915f
fix: restrict cross-compilation test to x86_64 runners only
- Only run make run-built-image on ubuntu-latest (x86_64) runners
- ARM64 runners cannot cross-compile for x86_64 due to linker architecture mismatch
- Prevents 'file in wrong format' errors when ARM64 musl-gcc tries to link x86_64 objects

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:58:43 -04:00
Jason Hall
c678342a5b
fix: use correct musl linker name in CI
- Change from x86_64-linux-musl-gcc to musl-gcc (provided by musl-tools package)
- Keep aarch64-linux-gnu-gcc for ARM64 cross-compilation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:53:53 -04:00
Jason Hall
635f680dd5
fix: update CI cross-compilation config and remove local config
- Move cross-compilation setup to CI workflow for better portability
- Remove local .cargo/config.toml to avoid conflicts
- Add cross-compilation config directly in CI test matrix
- Re-enable make run-built-image in main test job

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:47:20 -04:00
Jason Hall
7d8093a4f8
fix: add dedicated integration job for cross-compilation tests
- Restore integration job with CI-compatible linker configuration
- Use aarch64-linux-gnu-gcc instead of aarch64-linux-musl-gcc for CI
- Enable make run-built-image test in dedicated ubuntu-latest environment

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:43:03 -04:00
Jason Hall
a70fc36ef1
debug: enable run-built-image to investigate cross-compilation issues
Temporarily enable run-built-image in CI to see what specific
cross-compilation tools are missing in the ubuntu environment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:30:10 -04:00
Jason Hall
9d40a2683d
Comment out failing e2e test for now, save progress
Signed-off-by: Jason Hall <jason@chainguard.dev>
2025-06-08 20:25:15 -04:00
Jason Hall
9edb878ca5
ci: make builds and tests always verbose for better debugging
- Update Makefile to use --verbose flag by default for build and test targets
- Simplify CI workflow to use standard make targets instead of verbose variants
- Improve debugging visibility in CI by showing detailed cargo output

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:06:14 -04:00
Jason Hall
5444d76d83
ci: enhance workflow with matrix testing and ARM support
- Add matrix testing across ubuntu-latest and ubuntu-24.04-arm
- Test both stable and beta Rust toolchains
- Add comprehensive caching for cargo registry, index, and build
- Include cross-compilation verification steps
- Use make targets for consistent build and test execution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:04:56 -04:00
Jason Hall
5ff754c574
fix: simplify CI workflow to resolve linker issues
Remove complex cross-compilation setup that was causing linker
errors. The simplified approach should work with the available
system linkers and musl-tools package.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 20:02:07 -04:00
Jason Hall
dc09631004
fix: restore --image flag support for backward compatibility
Restore support for the --image flag that was accidentally removed
in the previous refactoring. This ensures all existing tests and
workflows continue to work while maintaining the digest-only approach.

- Restore image reference parsing with tag/digest stripping
- Maintain backward compatibility with existing CLI interface
- All integration tests now pass

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 19:57:06 -04:00
Jason Hall
6228bce97b
fix: remove automatic image tagging, make it optional
Images are now pushed by digest only by default, with optional tagging
via the new --tag flag. This addresses issue #27 by ensuring:

- No automatic :latest tags are applied during build
- Platform-specific images are never tagged for external use
- Only manifest lists can receive tags when explicitly requested
- Default behavior outputs digest-only references for reproducibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 19:42:00 -04:00
Jason Hall
f91d156266
refactor: Add make targets for cross-compilation setup
- Add setup-cross-compile target to create cargo config
- Add verify-cross-compile target to check setup
- Update CI to use make verify-cross-compile
- Simplifies CI workflow and centralizes cross-compile logic

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 12:05:07 -04:00
Jason Hall
e15bd1df8c
refactor: Centralize test flags and commands in Makefile
- Add TEST_FLAGS variable for single-threaded test execution
- Create verbose targets for CI usage
- Update pre-commit hooks to use make targets
- Update CI workflow to use make targets
- This ensures consistency between local and CI test execution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 12:02:29 -04:00
Jason Hall
c5b7bc1236
fix: Run tests single-threaded to avoid env var race conditions
- Update pre-commit hooks to use --test-threads=1
- Update CI workflow to run tests single-threaded
- This prevents test failures due to concurrent environment variable modifications

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 11:59:26 -04:00
Jason Hall
ccd4f829ac
run CI as parallel as possible
Signed-off-by: Jason Hall <jason@chainguard.dev>
2025-06-08 08:49:37 -04:00
Jason Hall
d7a8533116
fix: Use correct path for alpine-base example in CI
Instead of changing directories, pass the path directly to krust.
This ensures the command runs from the correct working directory
where the krust binary is located.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 08:45:06 -04:00
Jason Hall
c1d0f4f129
Merge pull request #7 from imjasonh/feat/supply-chain-security
feat: Add supply chain security improvements
2025-06-08 01:02:26 -04:00
Jason Hall
577c4152fe
fix: Add missing toolchain parameter to fmt and clippy jobs
The dtolnay/rust-toolchain action requires an explicit toolchain
parameter when pinned to a specific SHA.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 00:53:34 -04:00
Jason Hall
bd515ce3e2
feat: Add supply chain security improvements
- Pin all GitHub Actions to specific commit SHAs for immutability
- Add cargo-audit job to CI pipeline for vulnerability scanning
- Create SECURITY.md with vulnerability reporting guidelines
- Add Dependabot configuration for automated dependency updates
  - Weekly updates for both Cargo and GitHub Actions
  - Grouped patch and minor updates for Cargo dependencies
- Update job dependencies to run security checks before integration tests

This improves the project's security posture by:
1. Preventing action hijacking through SHA pinning
2. Catching known vulnerabilities early with cargo-audit
3. Providing clear security reporting channels
4. Automating dependency updates to reduce security debt

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 00:48:19 -04:00
Jason Hall
d3e2b881bb
Update .github/workflows/ci.yml 2025-06-08 00:43:30 -04:00
Jason Hall
532198dd5a
chore: Add alpine-base example for multi-platform testing
- Add example/alpine-base project that uses Alpine Linux as base image
- Update CI extended-platforms job to use the example directory
- Simplifies CI configuration by moving test project to examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 00:40:32 -04:00
Jason Hall
4f5f7fc644
run jobs as concurrently as possible
Signed-off-by: Jason Hall <jason@chainguard.dev>
2025-06-08 00:24:44 -04:00
Jason Hall
1f730645c3
feat: Expand platform support to match Alpine's supported architectures
- Add support for linux/386 (i686-unknown-linux-musl)
- Add support for linux/arm/v6 (arm-unknown-linux-musleabihf)
- Add support for linux/ppc64le (powerpc64le-unknown-linux-musl)
- Add support for linux/s390x (s390x-unknown-linux-musl)
- Add support for linux/riscv64 (riscv64gc-unknown-linux-musl)
- Update platform detection to include all new platforms
- Add tests for all new platform mappings
- Update documentation with installation instructions for all targets
- Add CI job to test extended platform support
- Update development setup docs to mention cargo-zigbuild for full platform support

This allows krust to build images for all platforms supported by Alpine Linux,
making it more versatile for multi-architecture container deployments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 00:07:56 -04:00
Jason Hall
d4b7b216df
Fix flaky tests with temp directories and update documentation
This commit eliminates test flakiness by building to unique temporary
directories and updates the README to reflect all changes in this branch.

Code changes:
- Modified RustBuilder to use tempfile::tempdir() for each build
- Added BuildResult struct to keep temp directory alive during image build
- Each build now gets its own isolated target directory
- Removed clean_example_dir() and all cleanup logic - no longer needed
- Tests can now run concurrently without interfering with each other

Documentation updates:
- Added "Isolated builds" and "Concurrent builds" to key features
- Added comprehensive "Build Process" section explaining the temp directory approach
- Updated multi-arch documentation to reflect default behavior (builds both platforms)
- Added "Multi-Architecture Images" section explaining how multi-arch works
- Documented that manifest list support is planned for future release

Benefits:
- No more "Built binary not found" errors
- Tests run reliably every time
- Concurrent test execution is now safe
- Simpler test code without cleanup logic
- Clear documentation of build isolation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 23:13:45 -04:00
Jason Hall
068ad65477
Improve platform detection and add multi-arch run test
- Updated get_test_platform() to detect runtime architecture in CI
  - CI tests use native platform (linux/amd64 on x86_64, linux/arm64 on aarch64)
  - Local development always uses linux/amd64 for consistency

- Added test_multi_arch_build_and_run() test
  - Builds multi-arch image and pushes to ttl.sh
  - Verifies the image runs correctly on the current architecture
  - Gracefully handles missing toolchain scenarios

- Updated CI integration test to verify multi-arch images can run
  - Builds for both linux/amd64 and linux/arm64
  - Runs the image to ensure Docker selects the correct architecture

This ensures we properly test both single and multi-arch scenarios.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 22:58:06 -04:00
Jason Hall
90c871f24d
Fix CI: Robust cross-compilation setup and tests
This commit fixes CI failures by:

1. Added cargo config setup to all test jobs:
   - Ensures correct linkers are configured before running tests
   - Uses x86_64-linux-musl-gcc for x86_64 targets
   - Uses aarch64-linux-gnu-gcc for ARM64 targets

2. Updated tests to handle cross-compilation gracefully:
   - Single-platform tests always use linux/amd64
   - Multi-platform tests attempt to build for both architectures
   - Tests verify the appropriate error messages if targets are missing
   - No tests are skipped - they either pass or fail with expected errors

3. Enhanced CI verification:
   - Added verification of aarch64-linux-gnu-gcc availability
   - Shows the cargo config being used

This ensures tests run consistently across all environments without skipping.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 22:52:38 -04:00
Jason Hall
6153452303
feat: Add multi-arch support
- Support building for multiple platforms with --platform flag
- Accept comma-separated platforms or multiple --platform flags
- Default to building for linux/amd64 and linux/arm64
- Add ARM runner (ubuntu-24.04-arm) to CI matrix
- Create manifest list for multi-arch images (TODO: push to registry)
- Update integration tests to handle multi-platform builds
- Add cross-compilation setup instructions to README
- Add .cargo/config.toml for local development

Breaking changes:
- Default behavior now builds for multiple platforms (amd64+arm64)
- Use --platform linux/amd64 to build for single platform
2025-06-07 22:28:15 -04:00
Jason Hall
5d254c7eca
Add tests to pre-commit hooks and simplify CI matrix
- Add cargo test and e2e tests to pre-commit hooks
- Temporarily disable macOS CI to focus on Linux
- Ensure all tests pass locally before committing
2025-06-07 22:03:28 -04:00
Jason Hall
40dbb7053e
Disable Windows CI temporarily
Remove Windows from the CI matrix to focus on getting Linux and macOS
working reliably first. Windows cross-compilation and Docker support
can be added back once the core functionality is stable.
2025-06-07 21:53:38 -04:00
Jason Hall
2e51f0ad49
Use douglascamata/setup-docker-macos-action for macOS Docker setup
This action properly installs and starts Docker daemon on macOS runners,
which is required for our integration tests.
2025-06-07 21:51:57 -04:00
Jason Hall
7a7f49c4a3
Ensure Docker is available on all platforms and fix Windows cross-compilation
- Use docker/setup-buildx-action for consistent Docker setup across all platforms
- Fix Windows rust-lld configuration by using full path instead of command name
- Make Docker-dependent tests fail explicitly when Docker is not available
- Add proper Docker availability check in integration tests

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 21:47:46 -04:00
Jason Hall
06b9e37db9
Fix cross-compilation and ensure all tests run on all platforms
- Add detailed error logging for cargo build failures (show both stdout and stderr)
- Install Docker on Windows and macOS CI runners
- Remove continue-on-error from test matrix - tests should fail properly
- Add detailed verification of cross-compilation setup in CI
- Improve Docker availability check in tests

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 21:39:18 -04:00
Jason Hall
5dc87b282e
Fix cross-compilation toolchain installation for all platforms
- macOS: Use messense/macos-cross-toolchains tap for musl toolchain
- Windows: Fix PowerShell syntax for creating cargo config
- Add verification step to check musl target installation
- Update builder to try platform-specific linker names
- Fix YAML syntax error in Windows config generation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 21:22:32 -04:00
Jason Hall
642472c548
Ensure all tests run on all platforms without skipping
- Remove test skipping based on target availability
- Install cross-compilation toolchains for all platforms in CI:
  - Ubuntu: musl-tools
  - macOS: musl-cross with proper cargo config
  - Windows: rust-lld linker
- Update builder to use platform-appropriate linkers
- Make full build/run workflow test mandatory in CI
- Add Docker setup and local registry for integration tests
- Set RUSTFLAGS with --cfg ci to enable CI-specific test behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 21:17:30 -04:00
Jason Hall
93bb4561fc
Add e2e tests and CI integration for docker run workflow
- Add comprehensive e2e tests for build functionality
- Add integration job to CI that tests `docker run $(krust build)`
- Test KRUST_REPO environment variable usage
- Test --no-push flag and clean stdout for command substitution
- Add tests for verbose logging
- Remove outdated basic_test.rs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 21:03:33 -04:00
Jason Hall
5e89023925
Initial commit: krust - container image build tool for Rust
krust builds container images for Rust applications without Docker:
- Builds static binaries using musl libc
- Creates minimal OCI container images
- Pushes to any OCI-compliant registry
- Outputs digest to stdout for composability

Inspired by ko.build for Go applications.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 20:46:08 -04:00