Deploy to Scalingo from GitLab CI/CD

This page describes steps to setup Continuous Deployment from GitLab CI/CD to Scalingo. Follow this guide to automatically deploy to Scalingo after a successful build.

Setup GitLab CI/CD Steps

Deploying to Scalingo is simplified by the dpl tool. To trigger a deployment after a success build on GitLab CI/CD, here are the steps to configure in your .gitlab-ci.yml:

  stage: deploy
    SCALINGO_APP_NAME: <app name>
    SCALINGO_REGION: osc-fr1
    GIT_DEPTH: 0
  image: ruby:3.1.3
    - develop
    - gem install dpl --pre
    - dpl --provider=scalingo --app=$SCALINGO_APP_NAME --api-token=$SCALINGO_API_TOKEN --region=$SCALINGO_REGION --branch=refs/heads/master

Specifying the remote branch (--branch) is necessary, otherwise you will get an error (unable to push to unqualified destination: master).

Scalingo API Token

The variable SCALINGO_API_TOKEN must be a valid API token created from the API Tokens page of the Dashboard.

Do NOT store this token in the .gitlab-ci.yml file. Please refer to this GitLab documentation.

Shallow Error

The GIT_DEPTH variable is required to avoid this error:

fatal: the remote end hung up unexpectedly
Fail to push the repository:
Shallow error:
The repository is shallowed and it cannot be updated.

More information about Shallow error here.

Suggest edits

Deploy to Scalingo from GitLab CI/CD

©2023 Scalingo