renovate-bot: Order of precedence (Vault vs. Variable) breaks infrastructure projects
Background
In the past, Renovate used a token stored in the RENOVATE_GITLAB_TOKEN CI variable. For infrastructure projects, this variable was defined at the gitlab-com/gl-infra group level.
Starting with feat: add support for fetching the Renovate Bot... (!694 - merged), Renovate may now read the token from vault instead, if the right conditions apply.
Problem
The way this is implemented has two problems:
-
The upgrade path is broken for many infrastructure projects. The Vault path is triggered if the
VAULT_SECRETS_PATHCI variable is defined. For projects managed throughinfra-mgmt, this is the case ifvault = {enabled = true}is configured. However, the token will only actually exist ifcommon_ci_tasks = {enabled = true}is configured. That means that infrastructure projects which use Vault for anything will break when upgradingcommon-ci-tasks. -
Continuing to use the centrally managed token is hard, because the Vault based configuration takes precedence.
Use case: In Runway we have a merge request pipeline which triggers a "dry-run" deployment in another project. In the past we granted permissions to @glrenovatebot so that these pipelines could run automatically. With PrATs, this is no longer possible. Hence, I'd prefer to continue using the group token.
Suggestion
I suggest that we copy the logic from semantic-release.yml, which uses the following order of precedence:
- explicit
vaultinput (custom Vault path) -
SEMANTIC_RELEASE_GITLAB_TOKENCI variable - default Vault path
This would effectively opt-out any infrastructure projects from Vault based authentication, as long as the group access token is available as a group-level CI variable.
If we want to migrate all infrastructure projects to using Vault instead of a CI variable, I think we need to ensure all applicable projects have the common_ci_tasks = {enabled = true} prior to making these sort of changes in common-ci-tasks.