You'll want to take advantage of services in bitbucket pipelines.
For the simple uses, you can create an empty database named 'pipelines' and use the 'root' user with password 'let_me_in' to connect on localhost:3306
pipelines: default: - step: image: node script: - npm install - npm test services: - mysql definitions: services: mysql: image: mysql environment: MYSQL_DATABASE: pipelines MYSQL_ROOT_PASSWORD: let_me_in
For more complex situations, you can create a test user to help validate database permissions and other priviledged settings.
The below bitbucket-pipelines.yml will create an empty database named 'pipelines' and user 'test_user' with password 'let_me_in' to connect on localhost:3306. The root user will have a random password created for it and not be accessible.
pipelines: default: - step: image: node script: - npm install - npm test services: - mysql definitions: services: mysql: image: mysql environment: MYSQL_DATABASE: pipelines MYSQL_RANDOM_ROOT_PASSWORD: 'yes' MYSQL_USERNAME: test_user MYSQL_PASSWORD: test_user_password
I tried with your configuration above:
MYSQL_DATABASE: pipelines MYSQL_RANDOM_ROOT_PASSWORD: yes MYSQL_USERNAME: test_user MYSQL_PASSWORD: test_user_password
but Pipeline said to me that:
The 'environment' section in your bitbucket-pipelines.yml file must be a map.
Obviously it was a map. I remove this environment and put original ones, taken from mysql docker hub page. It worked.
Probably this configuration is broken and you should update your documentation.
Thanks for the feedback! Turns out there was an issue where values like "yes" or "true" are being converted to booleans, which is causing some problems when they're loaded into the service container (yes becomes true for example).
Quoting these values will force them to be treated as strings - I'll be discussing this within the Pipelines team to try and improve the experience.
I just can't make this work. I get a `Exception: SQLSTATE[HY000]  php_network_getaddresses: getaddrinfo failed: Name or service not known` no matter what I do. I have tried a regular user and root user. I also tried using the hostname `mysql`. Nothing works. Can anyone confirm that this is actually a working thing?
I also get a `mysqld: Shutdown complete` at the end of the database service log. Why?
Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs