Hey Everyone !
I am new in BitBucket pipelines. My Problem is to test Database in pipelines. I am using java gradle to integrate pipeline. I searched so many things to use mysql but i cannot understand how to connect the database my pipelines and run into the cloud to check my test case . I am confusing how to use services of bitbucket. Please anyone Help me how to learn these things and implement on my assignement.
Thanks
@Vivek_ModiWelcome to the Community!
You will need to define service to use database in your pipeline.
You will get all information here - https://confluence.atlassian.com/bitbucket/test-with-databases-in-bitbucket-pipelines-856697462.html
It also include MySQL example.
Hello @DPKJ
Thanks for replying me. I already done this steps but how to access the database resources. I mean i need to test my database test case of CRUD functions. So how can i use all services in pipelines. Its simple like dummy local database in cloud. Sorry For inappropriate questions. Below is my pipeline File code.
image: openjdk:8
pipelines:default:- step:name: Test onlyscript:- bash PipeExample/scripts/build-projects.shservices:- mysqldefinitions:services:mysql:image: mysql:5.7environment:MYSQL_DATABASE: pipelinesMYSQL_ROOT_PASSWORD: root_user_passwordMYSQL_USER: test_userMYSQL_PASSWORD: test_user_password
@Vivek_Modi
As you have defined service and you know details of database connections, I don't think you should have any problems in next steps.
I tried this pipeline and I think it will give you idea of using it.
image: debian:stretchpipelines: pull-requests:'*': - step:script: - apt-get update && apt-get install -y mysql-client - mysql -h 127.0.0.1 -u root -ptest_user_password -e "SHOW DATABASES" services: - mysqldefinitions:services:mysql:image: mysql:5.7variables:MYSQL_DATABASE: 'pipelines'MYSQL_ROOT_PASSWORD: 'test_user_password'
It looks like you're new here. Sign in or register to get started.