We've recently integrated Github Actions into our projects and are wanting to switch mysql strict mode off for the github test suite.
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: github_db
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
I've tried adding an extra option "sql_mode" but that didn't work:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --sql_mode=""
I tried adding it as a command option:
command: --sql_mode=""
which gave the error Unexpected value 'command'
I've also tried adding it under variables:
variables:
strict_mode: false
But that gave the error:
Unexpected value 'variables'
Is there a way to turn strict mode off for mysql in our docker file?
Thanks in advance.
This is what worked for me:
docker create
under the hood, passing in the options
as flags. --name
is one of the available flags, spelled out in the docker docsservices:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: github_db
ports:
- 3306
options:
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
--name=somemysql
sql_mode
, in one line. steps:
(some steps)
...
- name: Change mysql sql_mode
run: >
docker exec somemysql mysql -u root -e "SET GLOBAL sql_mode = '';"
...
(Step that runs the tests goes here)