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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,462,680
Community Members
 
Community Events
176
Community Groups

Pipeline services ports customization

Hi everyone,
I started some time ago defining some build steps into BB pipelines, I found many useful features, among them the definition of services.


I've tried a postgres and a rabbitmq image to test the application I'm working on and as far as I run the services with the default ports everything works smoothly.


Now I'm trying to define a service with a postgres container exposed on a port different from the default one.

 

definitions:
services:
postgres:
image: postgres:14
variables:
POSTGRES_PASSWORD
: some_pass
POSTGRES_USER: some_user
ports:
"5433:5432"

 

This docker-like approach seems not to work, during the test steps the application is not able to reach the container.

Is there a way to achieve this without push/pull a custom image?

 

Thanks.

Best regards,

Federico

1 answer

1 accepted

1 vote
Answer accepted

Hi Federico,

I'm afraid that we don't support port mapping.

However, it is possible to use the PGPORT environment variable here: https://www.postgresql.org/docs/14/libpq-envars.html

You can define the service in the bitbucket-pipelines.yml file as follows:

definitions: 
services:
postgres:
image: postgres:14
environment:
POSTGRES_PASSWORD: 'test'
POSTGRES_DB: 'gstest'
PGPORT: '8432'

Is this something that works for you?

Kind regards,
Theodora

Hi Theodora,

  thank you for you answer! Yes this fits the requirement, I didn't know there were that enviromnent variable for the postgres container.

i hope in future pipelines will support port mapping for services, could be a very useful feature!

 

Thanks again.

Best regards,

Federico

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events