Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(manager/gitlabci): strip Gitlab Dependecy Proxy variable from dep…
…Name (#14734) Co-authored-by: Jamie Magee <jamie.magee@gmail.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: Rhys Arkins <rhys@arkins.net>
- Loading branch information
1 parent
982ceff
commit 3eec5b7
Showing
5 changed files
with
138 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Extracts Docker dependencies from `gitlab-ci.yml` files. | ||
|
||
If you need to change the versioning format, read the [versioning](https://docs.renovatebot.com/modules/versioning/) documentation to learn more. | ||
|
||
If you use Gitlab Dependency Proxy usage of the predefined variables `CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX` and `CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX` as image prefix is supported. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { getGitlabDep } from './utils'; | ||
|
||
describe('modules/manager/gitlabci/utils', () => { | ||
describe('getGitlabDep', () => { | ||
const defaultAutoReplaceStringTemplate = | ||
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}'; | ||
|
||
it.each` | ||
name | imagePrefix | ||
${'no variable'} | ${''} | ||
${'group proxy'} | ${'$CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/'} | ||
${'group proxy with brackets'} | ${'${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/'} | ||
${'direct group proxy'} | ${'$CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX/'} | ||
`('offical image - $name', ({ imagePrefix }: { imagePrefix: string }) => { | ||
const imageName = `${imagePrefix}mariadb:10.4.11`; | ||
expect(getGitlabDep(imageName)).toMatchObject({ | ||
autoReplaceStringTemplate: | ||
imagePrefix + defaultAutoReplaceStringTemplate, | ||
replaceString: imageName, | ||
depName: 'mariadb', | ||
currentValue: '10.4.11', | ||
}); | ||
}); | ||
|
||
it.each` | ||
name | imagePrefix | ||
${'no variable'} | ${''} | ||
${'group proxy'} | ${'$CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/'} | ||
${'group proxy with brackets'} | ${'${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/'} | ||
${'direct group proxy'} | ${'$CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX/'} | ||
`( | ||
'image with organization - $name', | ||
({ imagePrefix }: { imagePrefix: string }) => { | ||
const imageName = `${imagePrefix}renovate/renovate:19.70.8-slim`; | ||
expect(getGitlabDep(imageName)).toMatchObject({ | ||
autoReplaceStringTemplate: | ||
imagePrefix + defaultAutoReplaceStringTemplate, | ||
replaceString: imageName, | ||
depName: 'renovate/renovate', | ||
currentValue: '19.70.8-slim', | ||
}); | ||
} | ||
); | ||
|
||
it('no Docker hub', () => { | ||
expect( | ||
getGitlabDep('quay.io/prometheus/node-exporter:v1.3.1') | ||
).toMatchObject({ | ||
autoReplaceStringTemplate: defaultAutoReplaceStringTemplate, | ||
replaceString: 'quay.io/prometheus/node-exporter:v1.3.1', | ||
depName: 'quay.io/prometheus/node-exporter', | ||
currentValue: 'v1.3.1', | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters