Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Could not connect to mysql service from main container in Bitbucket Pipelines

 

Pipeline error stack:

Traceback (most recent call last): File "/usr/local/lib/python3.6/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/local/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name __import__(name) File "/opt/atlassian/pipelines/agent/build/tests.py", line 8, in <module> db = MySQLdb.connect(**settings.TEST_DATABASE) File "/usr/local/lib/python3.6/site-packages/MySQLdb/__init__.py", line 85, in Connect return Connection(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/MySQLdb/connections.py", line 204, in __init__ super(Connection, self).__init__(*args, **kwargs2)_mysql_exceptions.OperationalError: (1045, "Access denied for user 'test_user'@'127.0.0.1' (using password: YES)")

 

bitbucket-pipelines.yml:

image: nikolaik/python-nodejs:python3.6-nodejs8

pipelines:
default:
- step:
name: Python + JS unit tests
caches:
- docker
- pip
- node
script:
- cp -n settings_example.py settings.py
- python -V
- pip install --upgrade pip
- pip install -r requirements.txt
- python -m unittest discover
services:
- docker
- mysql

definitions:
services:
mysql:
image: mysql:5.6
environment:
MYSQL_DATABASE: pipelines
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USERNAME: test_user
MYSQL_PASSWORD: test_user_password

 

 

settings.py:


TEST_DATABASE = {
"host": "127.0.0.1",
"user": "test_user",
"password": "test_user_password",
"database": "pipelines"
}

 

 

I use example for mysql user from How to run common databases in Bitbucket Pipelines

It seems to be easy to setup but and I confused. What is my mistake?

 

1 comment

Hello,

I'm also encountering this issue.  How did it work out for you?

Thanks

With following config it works:

image: nikolaik/python-nodejs:python3.6-nodejs8

pipelines:
default:
- step:
name: Python + JS unit tests
caches:
- pip
- node
script:
- cp settings_example.py settings.py
- python -V
- pip install --upgrade pip
- pip install -r requirements.txt
- python -m unittest discover -v
services:
- mysql

definitions:
services:
mysql:
image: mysql:5.6
variables:
MYSQL_DATABASE: '​pipelines'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'test_user'
MYSQL_PASSWORD: 'test_user_password'

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events