-
Notifications
You must be signed in to change notification settings - Fork 241
chore: docker workflow refactor #2820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest Buf updates on your PR. Results from workflow CI and Release / buf-check (pull_request).
|
|
Claude finished @auricom's task —— View job Comprehensive Code Review: Docker Workflow RefactorI've completed a thorough review of this Docker workflow refactoring PR. The changes represent a significant improvement in modularity and organization. Below are my findings organized by focus area: 🎯 Overall AssessmentStrengths:
Areas for Improvement: See detailed findings below 🔒 1. Security FindingsCritical: Unpinned Docker Actions (Lines flagged by GitHub Security)Risk Level: Medium - Using version tags instead of commit SHAs creates supply chain risk Affected Files:
Current: - uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
- uses: docker/build-push-action@v6Recommended: - uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.10.0
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
- uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0Rationale: Commit SHA pinning prevents malicious code injection if action maintainers' accounts are compromised. This is a GitHub security best practice for production workflows. Missing Permissions in WorkflowsIssue: Current (ci.yml:61-64): test:
permissions:
actions: read
contents: read
uses: ./.github/workflows/test.ymlIssue: As reviewer @chatton noted, Recommendation: test:
permissions:
contents: read
uses: ./.github/workflows/test.yml
secrets: inheritDocker Image SecurityFinding:
Recommendation: Consider applying the same non-root user pattern to other Dockerfiles:
🏗️ 2. Code Quality & ArchitectureExcellent: Workflow Orchestration DesignThe new workflow architecture is well-designed: Strengths:
Issue: Redundant Workflow DependencyFile: docker-tests:
needs: [determine-image-tag, docker] # ← docker already depends on determine-image-tagIssue: Recommendation: docker-tests:
needs: docker # Sufficient - docker already waits for determine-image-tagIssue: Workflow Naming ClarityFile: As reviewer @chatton suggested, the filename should be more explicit about its purpose. Current: Rationale: The workflow is a reusable component that builds (and sometimes pushes) images. The simpler name better reflects its role as a building block. Good: Image Tag Determination LogicFile: The tag determination logic is well-implemented:
Minor Enhancement: Consider adding validation for maximum tag length (Docker tags max at 128 chars). 🐳 3. Dockerfile Reviewapps/testapp/DockerfileIssues:
Current (line 28): FROM base # Still contains Go toolchain, build toolsRecommended: FROM alpine:3.22.2 # Minimal runtime, ~5MB vs ~800MB
RUN apk --no-cache add ca-certificates
Recommended: COPY . .
RUN make install # Make target should handle dependenciesapps/evm/single/DockerfileIssue: Questionable build pattern (line 13) RUN go mod tidy && CGO_ENABLED=0 GOOS=linux go build -o evm-single .Problem: Running
Recommended: RUN CGO_ENABLED=0 GOOS=linux go build -o evm-single .Run apps/local-da/DockerfileGood practices observed:
Minor issue: Inconsistent WORKDIR convention (uses apps/grpc/single/DockerfileExcellent implementation:
This should be the reference implementation for other Dockerfiles. 📚 4. Documentation ReviewRELEASE.md - Excellent Comprehensive GuideStrengths:
Addresses Reviewer Concern: @tac0turtle suggested merging with an existing release doc. However, the current RELEASE.md appears to BE that consolidated document - it covers both Docker releases (new) and Go module releases. No additional merge appears necessary unless there's another release doc I'm not seeing. Minor suggestions:
⚡ 5. Performance & EfficiencyBuild Optimization OpportunitiesCurrent: Each Dockerfile follows its own pattern for dependency downloading. apps/evm/single/Dockerfile does this well (lines 5-8): COPY core core
COPY go.mod go.sum ./
RUN go mod download
COPY . .Rationale: Leverages Docker layer caching - dependencies only re-download if go.mod/go.sum changes. apps/testapp/Dockerfile could benefit from the same pattern (currently copies everything before downloading). Matrix Build EfficiencyFile: strategy:
matrix:
app: ${{ fromJson(inputs.apps) }}Good: Parallel builds for multiple apps 🧪 6. Testing & ReliabilityTest Workflow CleanupFile: Improvement: PR description notes "134 lines removed" - excellent cleanup! The test workflow is now focused solely on Go tests without Docker build concerns. Issue: Workflow still has Docker Test DependenciesFile: Good:
Enhancement: Consider adding timeout to prevent stuck jobs: docker-tests:
timeout-minutes: 30
# ...Merge Group OptimizationFile: if: github.event_name != 'merge_group'Excellent: Skips redundant builds for merge queue since images are already built on PRs. Smart optimization! 🔧 7. Error Handling & ResilienceRelease Tag ValidationFile: Excellent implementation:
This is exemplary error handling for workflows. Image Tag ValidationFile: if [[ ! "$TAG" =~ ^[a-zA-Z0-9._-]+$ ]]; then
echo "::error::Invalid image tag format: $TAG"
exit 1
fiGood: Prevents invalid Docker tags Missing: Retry Logic for Docker PushFiles: All workflows using Issue: Docker registry pushes can fail due to network issues, especially for multi-platform builds. Recommendation: Add retry logic or at least document expected behavior on transient failures. 📋 Addressing Reviewer Comments@tac0turtle's Comments:
@chatton's Comments:
🎯 Action Items SummaryHigh Priority (Security)
Medium Priority (Correctness)
Low Priority (Enhancement)
✅ ConclusionThis is a high-quality refactor that significantly improves the codebase's CI/CD architecture. The separation of concerns, reusable workflow pattern, and comprehensive documentation are excellent. Primary concerns:
Recommendation: Address the security concerns (action pinning, permissions), then this PR is ready to merge. The workflow architecture is solid and the documentation is comprehensive. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2820 +/- ##
=======================================
Coverage 64.64% 64.64%
=======================================
Files 81 81
Lines 7224 7224
=======================================
Hits 4670 4670
Misses 2014 2014
Partials 540 540
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
|
e2b4760 to
52a0c80
Compare
tac0turtle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
chatton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great refactor thanks for the cleanup, I just had a few comments about a few redundant dependencies and some renaming suggestions but nothing major.
## 🎯 Summary
This PR refactors the Docker build and release workflows to improve
maintainability, security, and separation of concerns. The changes
reorganize Dockerfiles into a consistent `apps/` directory structure and
split monolithic workflows into focused, reusable components.
---
## 📋 Changes
### Workflow Refactoring
- __Separated workflows__ for better modularity:
- `ci.yml` - Main CI orchestrator with image tag determination
- `docker.yml` - Reusable Docker build workflow
- `docker-tests.yml` - Docker image testing workflow
- `release.yml` - Tag-based release workflow for app publishing
- __Removed__ `ci_release.yml` (deprecated/consolidated into new
structure)
- __Enhanced__ `test.yml` - Simplified by removing Docker build logic
(134 lines removed)
### Docker Organization
- __Moved Dockerfiles__ to standardized locations:
- `Dockerfile` → `apps/testapp/Dockerfile`
- `da/cmd/local-da/Dockerfile` → `apps/local-da/Dockerfile`
- Updated `apps/grpc/single/Dockerfile` and `docker-compose.yml`
- __Removed__ `Dockerfile.da` (consolidated)
### Documentation
- __Added__ `.github/RELEASE_QUICK_START.md` (231 lines)
- Quick reference guide for Docker and Go module releases
## 🔄 Workflow Architecture
```javascript
┌─────────────┐
│ ci.yml │ (Main orchestrator)
└──────┬──────┘
│
├──► lint.yml
├──► docker.yml ──► Build images
├──► test.yml
├──► docker-tests.yml ──► Test images
└──► proto.yml
┌─────────────────┐
│ release.yml │ (Tag-based releases)
└─────────────────┘
│
└──► Build & push versioned images to GHCR
```
---
## 📝 Release Process
### Docker App Releases (Automated)
```bash
git tag evm/single/v0.2.0
git push origin evm/single/v0.2.0
# Workflow automatically builds and publishes to GHCR
```
### Tag Format
`{app-path}/v{major}.{minor}.{patch}`
Examples:
- `evm/single/v0.2.0` → `ghcr.io/evstack/ev-node-evm-single:v0.2.0`
- `testapp/v1.0.0` → `ghcr.io/evstack/ev-node-testapp:v1.0.0`
See [RELEASE_QUICK_START.md](.github/RELEASE_QUICK_START.md) for
complete guide.
---------
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* main: build(deps): Bump golangci/golangci-lint-action from 8.0.0 to 9.0.0 (#2826) build(deps): Bump actions/github-script from 7 to 8 (#2827) refactor: replace interface{} with any for clarity and modernization (#2829) add note on full node for evm (#2825) chore: docker workflow refactor (#2820) docs: add version notice warning about pre-v1 releases (#2824)
🎯 Summary
This PR refactors the Docker build and release workflows to improve maintainability, security, and separation of concerns. The changes reorganize Dockerfiles into a consistent
apps/directory structure and split monolithic workflows into focused, reusable components.📋 Changes
Workflow Refactoring
Separated workflows for better modularity:
ci.yml- Main CI orchestrator with image tag determinationdocker.yml- Reusable Docker build workflowdocker-tests.yml- Docker image testing workflowrelease.yml- Tag-based release workflow for app publishingRemoved
ci_release.yml(deprecated/consolidated into new structure)Enhanced
test.yml- Simplified by removing Docker build logic (134 lines removed)Docker Organization
Moved Dockerfiles to standardized locations:
Dockerfile→apps/testapp/Dockerfileda/cmd/local-da/Dockerfile→apps/local-da/Dockerfileapps/grpc/single/Dockerfileanddocker-compose.ymlRemoved
Dockerfile.da(consolidated)Documentation
Added
.github/RELEASE_QUICK_START.md(231 lines)🔄 Workflow Architecture
📝 Release Process
Docker App Releases (Automated)
git tag evm/single/v0.2.0 git push origin evm/single/v0.2.0 # Workflow automatically builds and publishes to GHCRTag Format
{app-path}/v{major}.{minor}.{patch}Examples:
evm/single/v0.2.0→ghcr.io/evstack/ev-node-evm-single:v0.2.0testapp/v1.0.0→ghcr.io/evstack/ev-node-testapp:v1.0.0See RELEASE_QUICK_START.md for complete guide.