Running migration on heroku

Eduardo de Vila May 14, 2021

Hi guys, I have a doubt about how I can run the migration on Heroku after deploy using pipe, can you help me with that?

This is my pipelines.yml:

image: ruby:2.4.2

pipelines:
default:
- step:
caches:
- bundler
- yarn
script:
- curl -sL https://deb.nodesource.com/setup_10.x | bash -
- apt-get install -y --force-yes nodejs
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
- apt-get update && apt-get install -y yarn
- yarn install
- export DATABASE_URL=postgresql://caiena:caiena@localhost/alpop_test
- bin/ci
- bin/webpack
- rspec
- cd ..
- tar czfv application.tgz build/
- mv application.tgz build/
- cd build
artifacts:
- application.tgz
services:
- redis
- postgres
- step:
name: Deploy to production
deployment: production
script:
- pipe: atlassian/heroku-deploy:0.1.1
variables:
HEROKU_API_KEY: $HEROKU_API_KEY
HEROKU_APP_NAME: $HEROKU_APP_NAME
ZIP_FILE: "application.tgz"


definitions:
caches:
bundler: ./vendor
yarn: ./node_modules
services:
redis:
image: redis
postgres:
image: postgres
environment:
POSTGRES_DB: alpop_test
POSTGRES_USER: caiena
POSTGRES_PASSWORD: caiena

1 answer

0 votes
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 14, 2021

Hi @Eduardo de Vila

Thank you for your question!

Currently the pipe support only deploy command.

Other commands you could run directly with the heroku cli.

 

Cheers,
Oleksandr Kyrdan

Eduardo de Vila May 14, 2021

I see, is it possible to run the Heroku CLI from the pipelines? If it is possible, can you send me an example?

Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 17, 2021

@Eduardo de Vila yes, for sure, you just execute bash code, just like you installed heroku cli locally to linux (follow https://devcenter.heroku.com/articles/heroku-cli#other-installation-methods) and follow also heroku doc depending on what you exactly need https://devcenter.heroku.com/articles/heroku-cli#getting-started.

Perhaps, if you need to login, you will need to create some secured repository variables for that to not expose this in the pipeline

Regards, Galyna

Like Eduardo de Vila likes this
Eduardo de Vila May 17, 2021

@Halyna Berezovskathank you about the answer. I just followed the article and now it's working perfectly.

Like Halyna Berezovska likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events