fix(buildkite): Catch '?' yaml syntax for plugins (#15666)

This commit is contained in:
scemily13 2022-05-22 00:42:08 -04:00 committed by GitHub
parent ab80d6e672
commit 1b28501d30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 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
: enforce_peer_deps: false

View file

@ -60,5 +60,16 @@ describe('modules/manager/buildkite/extract', () => {
};
expect(res).toEqual([expectedPackageDependency]);
});
it('extracts plugin with preceding ?', () => {
const res = extractPackageFile(Fixtures.get('pipeline8.yml'))?.deps;
const expectedPackageDependency: PackageDependency = {
currentValue: 'v3.2.7',
datasource: 'github-tags',
depName: 'some-org/some-plugin',
registryUrls: ['https://github.company.com'],
};
expect(res).toEqual([expectedPackageDependency]);
});
});
});

View file

@ -13,7 +13,7 @@ export function extractPackageFile(content: string): PackageFile | null {
for (const line of lines) {
// Search each line for plugin names
const depLineMatch = regEx(
/^[\s-]*(?<depName>[^#\s]+)#(?<currentValue>[^:]+)/
/^\s*(?:-\s+(?:\?\s+)?)?(?<depName>[^#\s]+)#(?<currentValue>[^:]+)/
).exec(line);
if (depLineMatch?.groups) {