Files
renovate/lib/modules/manager/copier/readme.md
jfra1397 932b7b26b5 feat(copier): convert ssh _src_path to https URL for datasource lookup (#44552)
Convert SSH-style template URLs to their HTTPS equivalent when
constructing the packageName for the git-tags datasource lookup,
mirroring what the git-submodules manager does. This allows the
lookup to be authenticated via hostRules credentials on setups
which access the Git host over HTTPS only.

The answers file itself keeps the original URL, so local
'copier update' runs by developers continue to use SSH.

Discussed in #44528
2026-07-29 06:19:46 +00:00

29 lines
1.9 KiB
Markdown

Keeps Copier templates up to date.
Supports multiple `.copier-answers(...).y(a)ml` files in a single repository.
If a template requires unsafe features, Copier must be invoked with the `--trust` flag.
Enabling this behavior must be allowed in the [self-hosted configuration](../../../self-hosted-configuration.md) via `allowScripts`.
Actually enable it in the [configuration](../../../configuration-options.md) by setting `ignoreScripts` to `false`.
If you need to change the versioning format, read the [versioning](../../versioning/index.md) documentation to learn more.
### Private Modules Authentication
To look up new template versions, Renovate converts SSH-style `_src_path` URLs (like `git+ssh://git@gitlab.com/some-org/some-template.git`) to their HTTPS equivalent, the same way the [`git-submodules`](../git-submodules/index.md) manager does.
This way the lookup works with `hostRules` credentials on setups which access the Git host via HTTPS only.
The answers file itself keeps the original URL.
Before running the `copier` command to update from the template, Renovate exports `git` [`insteadOf`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf) directives in environment variables.
Renovate uses this logic before it updates the template copy:
The token from the `hostRules` entry matching `hostType=github` and `matchHost=api.github.com` is added as the default authentication for `github.com`.
For those running against `github.com`, this token will be the default platform token.
Next, all `hostRules` with both a token or username/password and `matchHost` will be fetched, except for any `github.com` one from above.
Rules from this list are converted to environment variable directives if they match _any_ of these characteristics:
- No `hostType` is defined, or
- `hostType` is `git-tags`, or
- `hostType` is a platform (`github`, `gitlab`, `azure`, etc.)