-
Very nice, although I'd recommend using the Heroku API through dpl instead of using git to push to Heroku, i.e. something like (depending on your CI base image):
apt-get update -qy apt-get install -y ruby-dev gem install dpl dpl --provider=heroku --app=$PROJECT_NAME-$CI_COMMIT_REF_SLUG --api-key=$HEROKU_API_KEY
-
Someone asked (although that comment seems to be gone now, but I still think its a good question) if you still need to create the app in Heroku when using
dpl
: Yes, of course, the dpl part can be used instead of thegit
commands in the snippet above, you'd still need the initial curl call to the Heroku API to create the app. -
Hi all.
I tried to do similar thing but on bitbucket -- to enabled review apps there. I followed your steps, just used $BITBUCKET_BRANCH instead of $CI_COMMIT_REF_SLUG, but it failed :
No such app as <app_name>-<branch_name>.
Any ideas how to enable review apps there ?
Edited by Witold Sławko -
@WitoldSlawko: I don't know anything about Bitbucket, but for the Heroku side: Did you do the initial POST call to the Heroku
/apps
API to create the App on Heroku and did you use the exact same App name there? Also check the return code / value of that API call, maybe your branch name contains characters that are not allowed in an app name on Heroku (I had that error once). -
Hi @david.klotz Well I looked in logs: and I have seen this: { "id":"invalid_params", "message":"Name is too long (maximum is 30 characters)" }
Ah now I see that my <app_name>-<branch_name> is 36 characters long. Hmm, any ideas with which I can replace the <branch_name> AND is UNIQ per branch?? My <app_name> has got 12 characters. :/
-
@WitoldSlawko If it doesn't have to be super-beautiful, how about something like <app_name>-<commit_hash> from e.g.
git rev-parse --short HEAD
?
Please register or sign in to comment