mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
feat(buildkite): support git-hosted plugins (#13042)
This commit is contained in:
parent
91a3a971bb
commit
c2f713d769
5 changed files with 50 additions and 17 deletions
|
@ -8,14 +8,6 @@ steps:
|
|||
|
||||
- wait
|
||||
|
||||
# Use the app image built above to run concurrent tests
|
||||
- name: "Docker Test %n"
|
||||
command: test.sh
|
||||
parallelism: 25
|
||||
plugins:
|
||||
https://github.com/buildkite/plugin-docker-compose#v1.3.2:
|
||||
run: app
|
||||
|
||||
- name: "wrong"
|
||||
command: test.sh
|
||||
parallelism: 25
|
||||
|
|
6
lib/manager/buildkite/__fixtures__/pipeline5.yml
Normal file
6
lib/manager/buildkite/__fixtures__/pipeline5.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
steps:
|
||||
- plugins:
|
||||
- ssh://git@github.company.com/some-org/some-plugin#v3.2.7:
|
||||
username: abc
|
||||
- https://github.company.com/some-third-org/some-third-plugin#v0.0.1:
|
||||
build: app
|
|
@ -7,11 +7,6 @@ Array [
|
|||
"depName": "namespace/docker-compose",
|
||||
"skipReason": "invalid-version",
|
||||
},
|
||||
Object {
|
||||
"currentValue": "v1.3.2",
|
||||
"depName": "https://github.com/buildkite/plugin-docker-compose",
|
||||
"skipReason": "git-plugin",
|
||||
},
|
||||
Object {
|
||||
"currentValue": "v1.3.2",
|
||||
"depName": "github.com/buildkite/plugin-docker-compose",
|
||||
|
@ -53,6 +48,27 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`manager/buildkite/extract extractPackageFile() extracts git-based plugins 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"currentValue": "v3.2.7",
|
||||
"datasource": "github-tags",
|
||||
"depName": "some-org/some-plugin",
|
||||
"registryUrls": Array [
|
||||
"https://github.company.com",
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"currentValue": "v0.0.1",
|
||||
"datasource": "github-tags",
|
||||
"depName": "some-third-org/some-third-plugin",
|
||||
"registryUrls": Array [
|
||||
"https://github.company.com",
|
||||
],
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`manager/buildkite/extract extractPackageFile() extracts multiple plugins in same file 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
|
|
|
@ -5,6 +5,7 @@ const pipeline1 = loadFixture('pipeline1.yml');
|
|||
const pipeline2 = loadFixture('pipeline2.yml');
|
||||
const pipeline3 = loadFixture('pipeline3.yml');
|
||||
const pipeline4 = loadFixture('pipeline4.yml');
|
||||
const pipeline5 = loadFixture('pipeline5.yml');
|
||||
|
||||
describe('manager/buildkite/extract', () => {
|
||||
describe('extractPackageFile()', () => {
|
||||
|
@ -24,12 +25,17 @@ describe('manager/buildkite/extract', () => {
|
|||
it('adds skipReason', () => {
|
||||
const res = extractPackageFile(pipeline3).deps;
|
||||
expect(res).toMatchSnapshot();
|
||||
expect(res).toHaveLength(3);
|
||||
expect(res).toHaveLength(2);
|
||||
});
|
||||
it('extracts arrays of plugins', () => {
|
||||
const res = extractPackageFile(pipeline4).deps;
|
||||
expect(res).toMatchSnapshot();
|
||||
expect(res).toHaveLength(4);
|
||||
});
|
||||
it('extracts git-based plugins', () => {
|
||||
const res = extractPackageFile(pipeline5).deps;
|
||||
expect(res).toMatchSnapshot();
|
||||
expect(res).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -37,9 +37,20 @@ export function extractPackageFile(content: string): PackageFile | null {
|
|||
logger.trace('depLineMatch');
|
||||
let skipReason: SkipReason;
|
||||
let repo: string;
|
||||
if (depName.startsWith('https://') || depName.startsWith('git@')) {
|
||||
logger.debug({ dependency: depName }, 'Skipping git plugin');
|
||||
skipReason = SkipReason.GitPlugin;
|
||||
const gitPluginMatch = regEx(
|
||||
/(ssh:\/\/git@|https:\/\/)(?<registry>[^/]+)\/(?<gitPluginName>.*)/
|
||||
).exec(depName);
|
||||
if (gitPluginMatch) {
|
||||
logger.debug('Examining git plugin');
|
||||
const { registry, gitPluginName } = gitPluginMatch.groups;
|
||||
const dep: PackageDependency = {
|
||||
depName: gitPluginName,
|
||||
currentValue: currentValue,
|
||||
registryUrls: ['https://' + registry],
|
||||
datasource: datasourceGithubTags.id,
|
||||
};
|
||||
deps.push(dep);
|
||||
continue;
|
||||
} else if (isVersion(currentValue)) {
|
||||
const splitName = depName.split('/');
|
||||
if (splitName.length === 1) {
|
||||
|
@ -76,8 +87,10 @@ export function extractPackageFile(content: string): PackageFile | null {
|
|||
} catch (err) /* istanbul ignore next */ {
|
||||
logger.warn({ err }, 'Error extracting buildkite plugins');
|
||||
}
|
||||
|
||||
if (!deps.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return { deps };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue