You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I have an issue running tests that requires DB connection. First part where pipeline is built works fine. Even `php artisan migrate` goes through.
But Test step fails when test tries to add data to database with: `could not find driver (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')` . I tried changing host to 127.0.0.1 or mysql but it doesn't change anything.
Most of my .yml file is based on example I found in bitbucket documentation so I am nt sure why its not working.
Here is my bitbucket-pipelines.yml file:
# Template PHP Build
# This template allows you to validate your PHP application.
# The workflow allows running tests and code linting on the default branch.
- apt-get update && apt-get install -y unzip zip
- apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
- apt-get update && apt-get install -qy git curl libmcrypt-dev default-mysql-client
- docker-php-ext-install pdo pdo_mysql
- yes | pecl install mcrypt-1.0.6
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- COMPOSER_ALLOW_SUPERUSER=1 composer install
- cp .env.pipeline .env
- php artisan migrate --force
- php artisan test
And here is .env:
Hi Artis and welcome to the community!
At the moment there is no mechanism for a Pipelines build to wait for service startup (we have a request in our issue tracker for the build to wait until all services are ready: https://jira.atlassian.com/browse/BCLOUD-15244). If the command that fails is the first one in that step, the mysql service may not be ready yet. You can try adding a wait command as the first command of the build (e.g. for 5, 10 or 30 seconds) and see if that helps.
Please also ensure that:
You can also try debugging the build locally with Docker (using the same images you have in your yml file) to ensure that the configuration in your code is correct and the build succeeds locally with Docker:
In step 3 of the guide, there is a section on how to test with build services.