Error "invalid integer value "tcp://172.17.0.3:5432"" when use PostgreSQL in Gitlab CI #395
Closed
danny50610
started this conversation in
Ideas
Replies: 1 comment
-
|
This should be fixed via |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
When using PostgreSQL in Gitlab CI, executing
./vendor/bin/testbench migratewill encounter the following error messageBut using Mysql will not
The following is the result of executing
./vendor/bin/testbench config:show databaseI think the reason is that in Gitlab CI,
services(i.e. PostgreSQL) is connected using docker link.And according to the way Docker operates, the environment variable:
POSTGRES_PORTwill be created, and the value istcp://172.17.0.3:5432Then testbench will use this environment variable in HandlesDatabaseConnections.php and set it in laravel config
However, PostgreSQL does not accept this content, so it prints an error
Reference 1: https://stackoverflow.com/questions/42976181/postgresql-on-aws-ecs-psycopg2-operationalerror-invalid-port-number-5432
Reference 2: https://docs.gitlab.com/ee/ci/services/#how-services-are-linked-to-the-job
Reference 3: https://docs.docker.com/network/links/#environment-variables
Steps To Reproduce:
I create demo project:
https://gitlab.com/danny60072/testbench-postgres-port-test
The fail job: https://gitlab.com/danny60072/testbench-postgres-port-test/-/jobs/6284037647
Steps To Reproduce:
.gitlab-ci.ymlfilePossible temporary solution:
At present, I unset the
POSTGRES_PORTenvironment variable at the very beginning of CI, but I think maybe testbench can add a flag intestbench.yamlto prevent testbench from executing the actions inHandlesDatabaseConnections.phpBeta Was this translation helpful? Give feedback.
All reactions