Write your own CI/CD
There are several ways to automate your workflow when deploying your application to Clever Cloud from either GitHub or GitLab. This page explains how to write your custom CI/CD from both platforms.
Use Clever Tools
You can write your own pipeline to deploy from either GitHub or GitLab. Use Clever Cloud CLI with either Docker or Node image. Place the following snippets at the top of your .gitlab-ci.yml
file:
Docker image:
variables:
GIT_DEPTH: "0" # Unshallow the repository by default
image:
name: clevercloud/clever-tools:latest
entrypoint: [""]
Node image:
variables:
GIT_DEPTH: 0 # Unshallow the repository by default
before_script: # Download clever-tools before any script executes
- CC_VERSION=latest
- curl -s -O https://clever-tools.clever-cloud.com/releases/${CC_VERSION}/clever-tools-${CC_VERSION}_linux.tar.gz
- tar -xvf clever-tools-${CC_VERSION}_linux.tar.gz
- PATH=${PATH}:$(pwd)/clever-tools-${CC_VERSION}_linux
⚠️
Using
before_script
in your GitLab pipeline affects your other scripts as well. Consider including it in a separate job if you run other test scripts unrelated to Clever Cloud deployments in your pipeline.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.
🎓 Go further
Last updated on
Did this documentation help you ?