GitLab CI Component for Renovate¶
This GitLab CI/CD component automates dependency management using Renovate. Renovate is an open-source tool that automatically creates pull requests to update dependencies, ensuring your project stays up to date. This component integrates Renovate seamlessly into your GitLab CI/CD pipeline, offering a flexible and customizable solution for dependency updates.
Key Features¶
- Automated Dependency Updates: Automatically creates pull requests for updating dependencies.
- Flexible Configuration: Customizable stages, Docker images, and environment variables.
- CI/CD Integration: Integrates Renovate into your GitLab CI/CD pipeline for seamless operation.
Usage¶
You can integrate this component into your .gitlab-ci.yml file using the include keyword. It provides the flexibility to define different stages and configuration values, such as the Docker image used for Renovate.
Integrating the Component¶
To integrate the Renovate component into your pipeline, add the following snippet:
include:
- component: $CI_SERVER_FQDN/niclas-zone/ci/renovate/main@4.2.0
inputs:
job_name: "renovate"
stage: "deploy"
image: "ghcr.io/renovatebot/renovate:41.45"
RENOVATE_DEPENDENCY_DASHBOARD: true
This will execute Renovate in the specified deploy stage, using the provided Docker image.
Integrating testing of renovate configuration files¶
To validate your Renovate configuration and run a dry-run in the test stage, add:
include:
- component: $CI_SERVER_FQDN/niclas-zone/ci/renovate/test@4.2.0
inputs:
validate_config_job_name: "validate_renovate_config"
validate_config_stage: "test"
validate_config_image: "ghcr.io/renovatebot/renovate-slim"
dry_run_job_name: "dry_run_renovate"
dry_run_stage: "test"
dry_run_image: "ghcr.io/renovatebot/renovate-slim"
or in short to use the defaults:
include:
- component: $CI_SERVER_FQDN/niclas-zone/ci/renovate/test@4.2.0
- component: $CI_SERVER_FQDN/niclas-zone/ci/renovate/main@4.2.0
Component Specification¶
Available Inputs¶
The following inputs can be customized for the Renovate component:
| Input | Description | Default Value |
|---|---|---|
| job_name | The name of the CI job for Renovate | renovate |
| stage | The pipeline stage where the Renovate job runs | deploy |
| image | The Docker image used for running Renovate | ghcr.io/renovatebot/renovate:41.45 |
| RENOVATE_DEPENDENCY_DASHBOARD | Enables the Dependency Dashboard to track updates | true |
Example Jobs¶
1. Renovate Job¶
This job runs automatically on the main or master branch, with the option to trigger manually:
renovate:
image: $[[ inputs.image ]]
stage: $[[ inputs.stage ]]
script:
- renovate --dry-run=$RENOVATE_DEPENDENCY_DASHBOARD
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(main|master)$/'
when: always
- when: manual
allow_failure: true
2. Dry Run Job¶
Run a dry-run to test Renovate configuration before applying any actual changes:
dry_run_renovate:
image: ghcr.io/renovatebot/renovate-slim
stage: test
script:
- renovate --dry-run=full
rules:
- when: always
Secrets Management¶
Ensure that your GitLab token (RENOVATE_TOKEN) is securely stored as a protected CI/CD variable in your GitLab project settings. This is especially necessary for Renovate to authenticate and interact with GitLab's API.