diff --git a/lib/manager/buildkite/__fixtures__/pipeline3.yml b/lib/manager/buildkite/__fixtures__/pipeline3.yml index 4158f6806d00ab19ff3179fd91c043392a49238c..fe34280996ec19a6ea42d5a3d975eee1273808ff 100644 --- a/lib/manager/buildkite/__fixtures__/pipeline3.yml +++ b/lib/manager/buildkite/__fixtures__/pipeline3.yml @@ -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 diff --git a/lib/manager/buildkite/__fixtures__/pipeline5.yml b/lib/manager/buildkite/__fixtures__/pipeline5.yml new file mode 100644 index 0000000000000000000000000000000000000000..c8876504a0155302deed3f5349ad877dba052f17 --- /dev/null +++ b/lib/manager/buildkite/__fixtures__/pipeline5.yml @@ -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 diff --git a/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap b/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap index a10c85886d4a035af97a8b87c77e1759961da98f..7688b796bfddbf6ec3be736de9c018f8aca7799a 100644 --- a/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap @@ -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 { diff --git a/lib/manager/buildkite/extract.spec.ts b/lib/manager/buildkite/extract.spec.ts index 43dd8140be67a95a713bb04949f3cac2aa1b0210..1fe55b2c65765baaf7f7f5ccbac0610110c6eecd 100644 --- a/lib/manager/buildkite/extract.spec.ts +++ b/lib/manager/buildkite/extract.spec.ts @@ -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); + }); }); }); diff --git a/lib/manager/buildkite/extract.ts b/lib/manager/buildkite/extract.ts index 2c4ae344b59b20eacc4adb36d5ca62b5294dd495..6e008b5dbe1cca63eb1a982dc6b4c9a63f236178 100644 --- a/lib/manager/buildkite/extract.ts +++ b/lib/manager/buildkite/extract.ts @@ -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 }; }