My goal is to run database tests inside the CI pipeline for my Node.js application. I imagine it being that when I push code, the .yml script tells the runner to create a database and then when
npm test script is executed the database is already set up and waiting to be used for testing purposes. What I get instead is just
mysql: command not found with the given .yml script. I did set up the environment variables in the settings already.
I am quite inexperienced with the whole GitLab Runner environment so any pointers or tips on how can I fix or solve my problem is highly appreciated.
image: node:latest services: - mysql:5.7 variables: # Configure mysql service (https://hub.docker.com/_/mysql/) MYSQL_DATABASE: $MYSQL_DB MYSQL_ROOT_PASSWORD: $MYSQL_PASS stages: - install - db-setup - test install: stage: install script: - echo "NPM SET UP" - npm install db-setup: stage: db-setup script: - echo "DB SET UP:" - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql --execute "CREATE DATABASE "$MYSQL_DATABASE";" test: stage: test script: - echo "TEST RUN:" - npm test