-
Notifications
You must be signed in to change notification settings - Fork 123
fix: earthfile #645
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
fix: earthfile #645
Conversation
WalkthroughThe pull request introduces modifications to the Earthfile, focusing on enhancing the build and deployment processes. The changes include specifying a new base image, updating the deployment section to copy source files, and modifying the database schema export process. These alterations aim to improve the integration of source files and dependencies across different build stages, potentially streamlining the overall build and deployment workflow. Changes
Possibly related PRs
Poem
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
Earthfile (1)
Line range hint
64-87
: Enhance error handling and security in database schema export.The current implementation has several areas for improvement:
- No error handling for tool installation
- No timeout for database readiness check
- Missing cleanup for failure scenarios
- Credentials exposed in connection string
Consider applying these improvements:
export-database-schema: FROM +sources - RUN go install github.com/roerohan/wait-for-it@latest + RUN go install github.com/roerohan/wait-for-it@latest || exit 1 WITH DOCKER --load=postgres:15-alpine=+postgres --pull schemaspy/schemaspy:6.2.4 RUN bash -c ' + set -e # Exit on any error + trap "docker kill $postgresContainerID 2>/dev/null || true" EXIT echo "Creating PG server..."; postgresContainerID=$(docker run -d --rm -e POSTGRES_USER=root -e POSTGRES_PASSWORD=root -e POSTGRES_DB=formance --net=host postgres:15-alpine); - wait-for-it -w 127.0.0.1:5432; + wait-for-it -w -t 30 127.0.0.1:5432 || exit 1; echo "Creating bucket..."; - go run main.go buckets upgrade _default --postgres-uri "postgres://root:root@127.0.0.1:5432/formance?sslmode=disable"; + PGPASSWORD=root go run main.go buckets upgrade _default --postgres-uri "postgres://root@127.0.0.1:5432/formance?sslmode=disable"; echo "Exporting schemas..."; docker run --rm -u root \ -v ./docs/database:/output \ --net=host \ - schemaspy/schemaspy:6.2.4 -u root -db formance -t pgsql11 -host 127.0.0.1 -port 5432 -p root -schemas _system,_default; + schemaspy/schemaspy:6.2.4 -u root -db formance -t pgsql11 -host 127.0.0.1 -port 5432 -p "$POSTGRES_PASSWORD" -schemas _system,_default; - docker kill "$postgresContainerID"; ' END
🧹 Nitpick comments (1)
Earthfile (1)
Line range hint
52-57
: LGTM! Consider adding deployment logging.The deployment process looks solid with deterministic versioning based on source content SHA1.
Consider adding echo statements for better deployment tracking:
deploy: COPY (+sources/*) /src LET tag=$(tar cf - /src | sha1sum | awk '{print $1}') + RUN echo "Deploying version: $tag" WAIT BUILD --pass-args +build-image --tag=$tag END
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Earthfile
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Tests
🔇 Additional comments (1)
Earthfile (1)
6-6
: LGTM! Verify core module compatibility.The base image specification looks correct and aligns with the project structure.
Let's verify the core module version compatibility:
✅ Verification successful
✅ Core module compatibility verified
The base image specification is correctly configured and consistently used across the codebase, with matching version references (v0.19.0) in both the main Earthfile and tools/generator/Earthfile.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if the core module version is consistently referenced rg -l "formancehq/earthly.*v0.19.0"Length of output: 73
Script:
#!/bin/bash # Check the context of version references echo "=== Main Earthfile ===" rg "formancehq/earthly.*v0.19.0" Earthfile -C 2 echo -e "\n=== Generator Earthfile ===" rg "formancehq/earthly.*v0.19.0" tools/generator/Earthfile -C 2Length of output: 455
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #645 +/- ##
==========================================
- Coverage 81.65% 81.62% -0.03%
==========================================
Files 131 131
Lines 7070 7070
==========================================
- Hits 5773 5771 -2
- Misses 993 996 +3
+ Partials 304 303 -1 ☔ View full report in Codecov by Sentry. |
No description provided.