-
Notifications
You must be signed in to change notification settings - Fork 4.7k
chore: add postgres db during the startup conditionally #37605
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -48,7 +48,13 @@ jobs: | |||||||||||
| ports: | ||||||||||||
| # Opens tcp port 6379 on the host and service container | ||||||||||||
| - 6379:6379 | ||||||||||||
| postgres: | ||||||||||||
| if: github.base_ref == 'pg' || github.ref_name == 'pg' | ||||||||||||
| image: postgres:14 | ||||||||||||
| ports: | ||||||||||||
| - 5432:5432 | ||||||||||||
|
AnaghHegde marked this conversation as resolved.
|
||||||||||||
| mongo: | ||||||||||||
| if: "!contains(github.base_ref, 'pg') && github.ref_name != 'pg'" | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix invalid service-level condition syntax GitHub Actions doesn't support conditional service execution using the Consider this alternative approach: - mongo:
- if: "!contains(github.base_ref, 'pg') && github.ref_name != 'pg'"
- image: mongo
- ports:
- - 27017:27017
+ mongo:
+ image: mongo
+ ports:
+ - 27017:27017Then control the database selection through environment variables in the application configuration. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint57-57: unexpected key "if" for "services" section. expected one of "credentials", "env", "image", "options", "ports", "volumes" (syntax-check)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AnaghHegde can we remove the contains here as well? |
||||||||||||
| image: mongo | ||||||||||||
| ports: | ||||||||||||
| - 27017:27017 | ||||||||||||
|
|
||||||||||||
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.
Add PostgreSQL environment variables and restrict branch conditions
The PostgreSQL service configuration needs attention in two areas:
Apply this diff to enhance the configuration:
🧰 Tools
🪛 actionlint
52-52: unexpected key "if" for "services" section. expected one of "credentials", "env", "image", "options", "ports", "volumes"
(syntax-check)