Deploy from GitLab
How to set up you CI/CD from GitLab to deploy to Clever Cloud.
Use the Components Catalog
GitLab provides its 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>@~latestMandatory configuration
Your repository must contain at least the following variables to use the CLI:
CLEVER_TOKENCLEVER_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@~latestThis 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_TOKENandCLEVER_SECRET
<CI_PROJECT_PATH> configuration
In the project you want to deploy, replace <CI_PROJECT_PATH> with the actual path of the components, otherwise this variable fetches your project current path (which doesn’t host the CI/CD components). Depending on your platform, path can be different.
On gitlab.com
- component: $CI_SERVER_HOST/CleverCloud/clever-cloud-pipeline/deploy-to-prod@~latestOn Heptapod
- component: $CI_SERVER_HOST/pipelines/clever-cloud-pipeline/deploy-to-prod@~latestOn your self-hosted instance
- component: $CI_SERVER_HOST/<group>/<project>/deploy-to-prod@~latestDeploy 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:
- Create a
.gitlab-ci.ymlat the root of your repository with the component to use - Add the variables to your repository settings
- 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
Did this documentation help you ?