tags | ||
---|---|---|
|
In the CI process, there are some lines about setting configuration files like this:
- docker exec webcontainer bash -c "cat .env.gitlab-ci >> .env"
The .env.gitlab-ci
is like this:
DATABASE_URL=mysql://xxx:yyy@dbcontainer:3306/dbname?serverVersion=5.7
The .env
is like this:
# some useful stuff bablala
LOCK_DSN=semaphore
###< symfony/lock ###
What I did is removing the empty line in end of .env
, then it became:
# some useful stuff bablala
LOCK_DSN=semaphore
###< symfony/lock ###
Then the pipeline failed and gave an error:
An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused
WHY?
Because the deleted empty line matters.
With it, the .env
would be like:
# some useful stuff bablala
LOCK_DSN=semaphore
###< symfony/lock ###
DATABASE_URL=mysql://xxx:yyy@dbcontainer:3306/dbname?serverVersion=5.7
Without it, .env
would be like:
# some useful stuff bablala
LOCK_DSN=semaphore
###< symfony/lock ###DATABASE_URL=mysql://xxx:yyy@dbcontainer:3306/dbname?serverVersion=5.7
Bingo! The db connection gets crashed!!!
So, don't messy up empty lines. They matter.