Closed AKorezin closed 1 year ago
Very strange, it failes here: https://github.com/renovatebot/renovate/blob/48c33bee7df993923674da95d9d1a170434b82b2/lib/workers/branch/auto-replace.ts#L143-L143
So existingContent
is null | undefined
and is passed from here:
https://github.com/renovatebot/renovate/blob/3be44469bb98600a8f839887f9cb3c5c6bf975f3/lib/workers/branch/get-updated.ts#L98-L103
i think it because the leading slash at /2/.gitlab-ci.yml
.
{
"packageFile": "/2/.gitlab-ci.yml",
"deps": [
{
"depName": "docker",
"currentValue": "20.10.7",
"currentDigest": "sha256:bfc499cef26daa22da31b76be1752813a6921ee1fa1dd1f56d4fdf19c701d332",
"replaceString": "docker:20.10.7@sha256:bfc499cef26daa22da31b76be1752813a6921ee1fa1dd1f56d4fdf19c701d332",
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
"datasource": "docker",
"depType": "image",
"depIndex": 0,
"updates": [],
"warnings": [],
"versioning": "docker",
"currentVersion": "20.10.7",
"fixedVersion": "20.10.7"
},
{
"depName": "docker",
"currentValue": "20.10.7-dind",
"currentDigest": "sha256:4e1e22f471afc7ed5e024127396f56db392c1b6fc81fc0c05c0e072fb51909fe",
"replaceString": "docker:20.10.7-dind@sha256:4e1e22f471afc7ed5e024127396f56db392c1b6fc81fc0c05c0e072fb51909fe",
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
"datasource": "docker",
"depType": "service-image",
"depIndex": 1,
"updates": [
{
"updateType": "digest",
"newValue": "20.10.7-dind",
"newDigest": "sha256:b36fdccb118bfaa8d5026da5183a077b87bc790051fcd2c5686bfb8f7fa2563c",
"branchName": "renovate/docker-20.10.7-dind"
}
],
"warnings": [],
"versioning": "docker",
"currentVersion": "20.10.7",
"fixedVersion": "20.10.7-dind"
}
]
@AKorezin Is the leading slash supported by gitlab-ci?
So getFile
fails:
https://github.com/renovatebot/renovate/blob/3be44469bb98600a8f839887f9cb3c5c6bf975f3/lib/workers/branch/get-updated.ts#L36-L42
https://github.com/renovatebot/renovate/blob/42f6c5b29549f79431e5ce5d619fbd5453800bfb/lib/util/git/index.ts#L638-L652 as git doesn't know about leading slashes
@viceice
I use multiple includes hack described here https://gitlab.com/gitlab-org/gitlab/-/issues/28987.
Yes it is valid syntax. Multiple successive /
symbols should be translated to single /
.
I think this should work like in linux. ls //
is equivalent to ls /
.
Except /
path is root of git repo.
Also here https://docs.gitlab.com/ee/ci/yaml/includes.html
But if /
is used in gitlab-ci script, then it would point to executor root.
CI_PROJECT_DIR
environment variable points to cloned repository root.
Also my small repo is a simplified version of a large repo.
I use the same pattern here.
In file /containers/container.gitlab-ci.yml
include:
- local: "//containers/docker.gitlab-ci.yml"
And include them like in this tests.
In file /.gitlab/tests/containers/container.gitlab-ci.yml
include:
- local: "/containers/container.gitlab-ci.yml"
And the result of such include can be observed in this sub pipeline.
So we just need to trim the leading slash as workaround?
And also check other variants of multiple /
symbols in different parts of include string.
Maybe other sequences like /./
should be also checked.
Hi there,
Get your issue fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible.
Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.
To get started, please read our guide on creating a minimal reproduction.
We may close the issue if you, or someone else, haven't created a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.
Good luck,
The Renovate team
Updated reproduction repository at gitlab.com because #17132 fixed leading slashes.
How are you running Renovate?
If using the hosted app, please skip to the next section. Otherwise, if self-hosted, please complete the following:
Please select which platform you are using:
Renovate version: 25.26.10
Describe the bug
Renovate bot fails to update container image version in
.gitlab-ci.yml
if file is included multiple times in other.gitlab-ci.yml
. Maybe this issue is related only toservices:
part, because previously there was successful update ofimage:
.Relevant debug logs
Click me to see logs
``` DEBUG: Using RE2 as regex engine DEBUG: Parsing configs DEBUG: Checking for config file in /builds/AKorezin-renovate-bot/renovate-runner/config DEBUG: No config file found on disk - skipping DEBUG: Enabling debug logging to renovate-log.ndjson DEBUG: File config "config": {} DEBUG: CLI config "config": {"repositories": ["AKorezin/renovate-docker-dind-gitlab-ci"]} DEBUG: Env config "config": { "hostRules": [ {"hostType": "github", "matchHost": "github.com", "token": "***********"}, { "hostType": "docker", "matchHost": "env.ci.runner.short", "token": "***********" } ], "extends": ["github>whitesource/merge-confidence:beta"], "repositoryCache": "true", "binarySource": "docker", "baseDir": "/builds/AKorezin-renovate-bot/renovate-runner/renovate", "logFile": "renovate-log.ndjson", "logFileLevel": "debug", "onboarding": false, "onboardingConfig": { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:base"] }, "requireConfig": true, "optimizeForDisabled": true, "platform": "gitlab", "endpoint": "https://gitlab.com/api/v4", "token": "***********", "gitAuthor": "Renovate BotHave you created a minimal reproduction repository?
https://gitlab.com/AKorezin/renovate-docker-dind-gitlab-ci
Additional context
I use multiple includes hack described here. I also tested this bug with local container with this command
docker run -it -e RENOVATE_PLATFORM=gitlab -e LOG_LEVEL=debug -e RENOVATE_TOKEN=token renovate/renovate:25.56-slim renovate AKorezin/renovate-docker-dind-gitlab-ci