It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Install Postgres extensions in bitbucket pipeline

So reading the docs I see that setting up Postgres in a bitbucket pipeline is as simple as adding the following:

image: node 
    - step: 
          - npm install
          - npm test
          - postgres

      image: postgres 
        POSTGRES_DB: 'pipelines' 
        POSTGRES_USER: 'test_user'
        POSTGRES_PASSWORD: 'test_user_password'

What I'd like to know is how I can install some extensions in the database before proceeding further?

2 answers

Hello, I had the same problem and I managed to solve it with this configuration:


image: node:8.11.1 # or any image you need

clone:  depth: 1       # include the last commit
image: postgres environment:
POSTGRES_DB: test POSTGRES_USER: postgres POSTGRES_PASSWORD: your_password pipelines: default: - step:
caches: - node script: - npm install - apt-get update - apt-get -y install postgresql-client - ./bin/utilities/ -h localhost -p 5432 -t 30 - PGPASSWORD=your_password psql -h localhost -p 5432 -c "create extension if not exists \"uuid-ossp\"; create extension if not exists pg_trgm;" -U postgres test; - npm test test/drivers/* test/helpers/* test/models/* services: - postgres

My full answer with more explanations can be found here:

Hey, I had the same problem, and I've answered it here:

Hi Alexandros,

I am facing the same problem but unable install postgis extension.


@Yadvendra Singhhow does it fail for you? What it basically does is to isntall "psql" and run the create extension commands inside the database, seems pretty fail-safe!

I still use this way everyday!

it is failing at create extension postgis.


- PGPASSWORD=XXXXXX psql -h localhost -p 5432 -c "create extension postgis; create extension postgis_topology;" -U postgres bgs;

ERROR: could not open extension control file "/usr/share/postgresql/12/extension/postgis.control": No such file or directory

@Yadvendra Singhthis is a postgis-related problem. With a quick google search with this error message, a lot of results were returned, especially in stackoverflow, with highly voted answers, like this one:

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

592 views 2 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you