Chore: add fast development build system for operator images#6339
Chore: add fast development build system for operator images#6339fgksgf wants to merge 4 commits intopingcap:feature/v2from
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/run-pull-e2e-kind-v2 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/v2 #6339 +/- ##
===========================================
Coverage 45.12% 45.12%
===========================================
Files 317 317
Lines 21218 21218
===========================================
Hits 9574 9574
Misses 11644 11644
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
55a2d1c to
2374ffd
Compare
|
/run-pull-e2e-kind-v2 |
2374ffd to
d5f43fc
Compare
|
/run-pull-e2e-kind-v2 |
|
/run-pull-e2e-kind-v2 |
|
/run-pull-e2e-kind-v2 |
|
/run-pull-e2e-kind-v2 |
|
/run-pull-e2e-kind-v2 |
3 similar comments
|
/run-pull-e2e-kind-v2 |
|
/run-pull-e2e-kind-v2 |
|
/run-pull-e2e-kind-v2 |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a fast development build system for operator images to accelerate the development and testing workflow. Instead of rebuilding Go binaries during Docker image creation, it uses pre-compiled local binaries, reducing build time from minutes to approximately 2 seconds.
Key changes:
- Adds a development-specific Dockerfile that copies pre-compiled binaries instead of compiling from source
- Enhances the build system with DEV_MODE flag to toggle between development and production builds
- Updates documentation to explain the new fast build workflow
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| image/Dockerfile.dev | New development Dockerfile that copies pre-compiled binaries for faster builds |
| hack/lib/image.sh | Enhanced image build script with support for custom Dockerfile and dockerignore files |
| docs/CONTRIBUTING.md | Updated documentation explaining the new DEV_MODE build system |
| Makefile | Added DEV_MODE logic for image and push targets with dev-prepare-output helper |
| .github/licenserc.yaml | Added .dockerignore.dev to license check exclusions |
| .dockerignore.dev | New dockerignore file optimized for development builds |
| if [[ -n "$dockerignore" ]]; then | ||
| # Backup original .dockerignore if it exists | ||
| if [[ -f "$ROOT/.dockerignore" ]]; then | ||
| dockerignore_backup="$ROOT/.dockerignore.backup.$$" |
There was a problem hiding this comment.
Using $$ (process ID) for backup filename could cause race conditions if multiple builds run simultaneously. Consider using a more unique identifier like $(date +%s%N) or mktemp to generate unique backup filenames.
| dockerignore_backup="$ROOT/.dockerignore.backup.$$" | |
| dockerignore_backup="$(mktemp "$ROOT/.dockerignore.backup.XXXXXX")" |
| fi | ||
| # Copy custom dockerignore | ||
| cp "$ROOT/$dockerignore" "$ROOT/.dockerignore" | ||
| fi |
There was a problem hiding this comment.
The cp command could fail if the source dockerignore file doesn't exist, but there's no error handling. Add a check to ensure the source file exists before copying.
| fi | |
| if [[ ! -f "$ROOT/$dockerignore" ]]; then | |
| echo "Error: Custom dockerignore file '$ROOT/$dockerignore' does not exist." >&2 | |
| # Restore original .dockerignore if it was backed up | |
| if [[ -n "$dockerignore_backup" && -f "$dockerignore_backup" ]]; then | |
| mv "$dockerignore_backup" "$ROOT/.dockerignore" | |
| fi | |
| exit 1 | |
| fi | |
| cp "$ROOT/$dockerignore" "$ROOT/.dockerignore" |
What problem does this PR solve?
What is changed and how does it work?
Skip Go module downloads and compilation by using pre-compiled local binaries when use
make dev-image/xxxCode changes
Tests
Side effects
Related changes
Release Notes
Please refer to Release Notes Language Style Guide before writing the release note.