fix(manager/buildkite): Strip '.git' from git-based plugin names (#14292)

* strip .git from applicable git-based buildkite plugin names

* Update lib/manager/buildkite/extract.ts

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

* add toEqual matcher in jest test

* Update lib/manager/buildkite/extract.spec.ts

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

* Update lib/manager/buildkite/extract.spec.ts

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

* remove obsolete snapshot

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
scemily13 2022-02-21 16:26:35 -05:00 committed by GitHub
parent 9a103cbb51
commit dd08fd9f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,4 @@
steps:
- plugins:
- ssh://git@github.company.com/some-org/some-plugin.git#v3.2.7:
username: abc

View file

@ -1,4 +1,5 @@
import { Fixtures } from '../../../test/fixtures';
import type { PackageDependency } from '../../manager/types';
import { extractPackageFile } from './extract';
describe('manager/buildkite/extract', () => {
@ -31,5 +32,16 @@ describe('manager/buildkite/extract', () => {
expect(res).toMatchSnapshot();
expect(res).toHaveLength(2);
});
it('extracts git-based plugin with .git at the end of its name', () => {
const expectedPackageDependency: PackageDependency = {
currentValue: 'v3.2.7',
datasource: 'github-tags',
depName: 'some-org/some-plugin',
registryUrls: ['https://github.company.com'],
};
const res = extractPackageFile(Fixtures.get('pipeline6.yml')).deps;
expect(res).toHaveLength(1);
expect(res).toEqual([expectedPackageDependency]);
});
});
});

View file

@ -43,8 +43,9 @@ export function extractPackageFile(content: string): PackageFile | null {
if (gitPluginMatch) {
logger.debug('Examining git plugin');
const { registry, gitPluginName } = gitPluginMatch.groups;
const gitDepName = gitPluginName.replace(regEx('\\.git$'), '');
const dep: PackageDependency = {
depName: gitPluginName,
depName: gitDepName,
currentValue: currentValue,
registryUrls: ['https://' + registry],
datasource: GithubTagsDatasource.id,