Deploy from GitLab

Deploy from GitLab

How to set up you CI/CD from GitLab to deploy to Clever Cloud.

Use the Components Catalog

GitLab provides it’s own way of deploying applications to any host provider. The CI/CD system differs from GitHub Actions, but Clever Cloud has already worked on ways to ease the process. Find components in GitLab Components Catalog to build a modular pipeline for your project.

To use a component, add this snippet to your .gitlab-ci.yml file:

include:
  - component: $CI_SERVER_HOST/$CI_PROJECT_PATH/<component-name>@~latest

Mandatory configuration

Your repository must contain at least the following variables to use the CLI:

  • CLEVER_TOKEN
  • CLEVER_SECRET

Find it in your machine, usually in ~/.config/clever-cloud/clever-tools.json, after installing Clever Tools.

โš ๏ธ CLEVER_TOKEN and CLEVER_SECRET expire after one year. Make sure to set a reminder to inject the new ones to avoid breaking your pipelines.

GitLab pipeline example

For example, to deploy any commit on your production app, use:

include:
  - component: $CI_SERVER_HOST/$CI_PROJECT_PATH/deploy-to-prod@~latest

This assumes you have a running app on Clever Cloud. Any commit on your default branch (main, master or other name) triggers a deployment for this app. Inject the following variables in your GitLab repository settings:

  • APP_ID: Find it at the top right in Clever Cloud Console, in your application tab.
  • CLEVER_TOKEN and CLEVER_SECRET

Deploy from a self-hosted GitLab instance

You can use pipeline components to deploy from a self-hosted GitLab instance, by including it as a project and mirroring the pipeline repository. Follow GitLab documentation to get full instructions.

Deploy directly from Heptapod

The self-hosted GitLab service on Clever Cloud with Heptapod already hosts the components, you don’t need to do any set up like you would in a self-hosted instance:

  1. Create a .gitlab-ci.yml at the root of your repository with the component to use
  2. Add the variables to your repository settings
  3. Run the pipeline

Troubleshooting

If you encounter troubles or bugs using the GitLab component, feel free to open an issue on the repository:

๐ŸŽ“ Go further

Last updated on

Did this documentation help you ?