diff --git a/lib/constants/data-binary-source.ts b/lib/constants/data-binary-source.ts index 53738b88a6e1b449939839c4f72cbb0bfb4cafa5..02ca6814958c8c3d5f44b53d26dbff6d33bed8c0 100644 --- a/lib/constants/data-binary-source.ts +++ b/lib/constants/data-binary-source.ts @@ -6,8 +6,9 @@ export const DATASOURCE_DART = 'dart'; export const DATASOURCE_DOCKER = 'docker'; export const DATASOURCE_GIT_SUBMODULES = 'git-submodules'; export const DATASOURCE_GIT_TAGS = 'git-tags'; -export const DATASOURCE_GITHUB = 'github'; -export const DATASOURCE_GITLAB = 'gitlab'; +export const DATASOURCE_GITHUB_RELEASES = 'github-releases'; +export const DATASOURCE_GITHUB_TAGS = 'github-tags'; +export const DATASOURCE_GITLAB_TAGS = 'gitlab-tags'; export const DATASOURCE_GO = 'go'; export const DATASOURCE_GRADLE_VERSION = 'gradle-version'; export const DATASOURCE_HELM = 'helm'; diff --git a/lib/datasource/common.ts b/lib/datasource/common.ts index f7ad071248c26935ed9dd5f1901fe6cd6d7f55e3..665cc551aa79c9face91fec14e844089375f6d6a 100644 --- a/lib/datasource/common.ts +++ b/lib/datasource/common.ts @@ -9,7 +9,6 @@ export interface Config { export interface PkgReleaseConfig extends Config { compatibility?: Record<string, string>; depType?: string; - lookupType?: string; npmrc?: string; versioning?: string; } diff --git a/lib/datasource/github/__snapshots__/index.spec.ts.snap b/lib/datasource/github-releases/__snapshots__/index.spec.ts.snap similarity index 52% rename from lib/datasource/github/__snapshots__/index.spec.ts.snap rename to lib/datasource/github-releases/__snapshots__/index.spec.ts.snap index e2b0146acbe235363740aed7e9fe48499ff7d28d..9eeabf0cc6cf4f9d7be65e98cb72376419eae3ee 100644 --- a/lib/datasource/github/__snapshots__/index.spec.ts.snap +++ b/lib/datasource/github-releases/__snapshots__/index.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`datasource/github getPkgReleases returns releases 1`] = ` +exports[`datasource/github-releases getPkgReleases returns releases 1`] = ` Object { "releases": Array [ Object { @@ -23,19 +23,3 @@ Object { "sourceUrl": "https://github.com/some/dep", } `; - -exports[`datasource/github getPkgReleases returns tags 1`] = ` -Object { - "releases": Array [ - Object { - "gitRef": "v1.0.0", - "version": "v1.0.0", - }, - Object { - "gitRef": "v1.1.0", - "version": "v1.1.0", - }, - ], - "sourceUrl": "https://github.com/some/dep2", -} -`; diff --git a/lib/datasource/github-releases/index.spec.ts b/lib/datasource/github-releases/index.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..4213117cfd5ff66e50b525a927ce97e52dafaa0f --- /dev/null +++ b/lib/datasource/github-releases/index.spec.ts @@ -0,0 +1,33 @@ +import { api } from '../../platform/github/gh-got-wrapper'; + +import * as github from '.'; + +jest.mock('../../platform/github/gh-got-wrapper'); +jest.mock('../../util/got'); +jest.mock('../../util/host-rules'); + +const ghGot: any = api.get; + +describe('datasource/github-releases', () => { + beforeEach(() => global.renovateCache.rmAll()); + describe('getPkgReleases', () => { + beforeAll(() => global.renovateCache.rmAll()); + it('returns releases', async () => { + const body = [ + { tag_name: 'a' }, + { tag_name: 'v' }, + { tag_name: '1.0.0' }, + { tag_name: 'v1.1.0' }, + ]; + ghGot.mockReturnValueOnce({ headers: {}, body }); + const res = await github.getPkgReleases({ + lookupName: 'some/dep', + }); + expect(res).toMatchSnapshot(); + expect(res.releases).toHaveLength(4); + expect( + res.releases.find(release => release.version === 'v1.1.0') + ).toBeDefined(); + }); + }); +}); diff --git a/lib/datasource/github-releases/index.ts b/lib/datasource/github-releases/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee041ba977c3910af47fd6987b85edba2c5320f8 --- /dev/null +++ b/lib/datasource/github-releases/index.ts @@ -0,0 +1,60 @@ +import { api } from '../../platform/github/gh-got-wrapper'; +import { ReleaseResult, PkgReleaseConfig } from '../common'; +import { logger } from '../../logger'; + +const { get: ghGot } = api; + +const cacheNamespace = 'datasource-github-releases'; + +/** + * github.getPkgReleases + * + * This function can be used to fetch releases with a customisable versioning (e.g. semver) and with releases. + * + * This function will: + * - Fetch all releases + * - Sanitize the versions if desired (e.g. strip out leading 'v') + * - Return a dependency object containing sourceUrl string and releases array + */ +export async function getPkgReleases({ + lookupName: repo, +}: PkgReleaseConfig): Promise<ReleaseResult | null> { + let versions: string[]; + const cachedResult = await renovateCache.get<ReleaseResult>( + cacheNamespace, + repo + ); + // istanbul ignore if + if (cachedResult) { + return cachedResult; + } + try { + const url = `https://api.github.com/repos/${repo}/releases?per_page=100`; + type GitHubRelease = { + tag_name: string; + }[]; + + versions = ( + await ghGot<GitHubRelease>(url, { + paginate: true, + }) + ).body.map(o => o.tag_name); + } catch (err) /* istanbul ignore next */ { + logger.debug({ repo, err }, 'Error retrieving from github'); + } + // istanbul ignore if + if (!versions) { + return null; + } + const dependency: ReleaseResult = { + sourceUrl: 'https://github.com/' + repo, + releases: null, + }; + dependency.releases = versions.map(version => ({ + version, + gitRef: version, + })); + const cacheMinutes = 10; + await renovateCache.set(cacheNamespace, repo, dependency, cacheMinutes); + return dependency; +} diff --git a/lib/datasource/github-tags/__snapshots__/index.spec.ts.snap b/lib/datasource/github-tags/__snapshots__/index.spec.ts.snap new file mode 100644 index 0000000000000000000000000000000000000000..326ad0ee45c5fb3a40cbbef20d5256e1e82e748f --- /dev/null +++ b/lib/datasource/github-tags/__snapshots__/index.spec.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`datasource/github-tags getPkgReleases returns tags 1`] = ` +Object { + "releases": Array [ + Object { + "gitRef": "v1.0.0", + "version": "v1.0.0", + }, + Object { + "gitRef": "v1.1.0", + "version": "v1.1.0", + }, + ], + "sourceUrl": "https://github.com/some/dep2", +} +`; diff --git a/lib/datasource/github/index.spec.ts b/lib/datasource/github-tags/index.spec.ts similarity index 81% rename from lib/datasource/github/index.spec.ts rename to lib/datasource/github-tags/index.spec.ts index 6d9617ad3f6202ac9dd1dbb39b0cbb8b949698a1..aaad1a536a09bee8246846aa9b180a1f98774167 100644 --- a/lib/datasource/github/index.spec.ts +++ b/lib/datasource/github-tags/index.spec.ts @@ -10,7 +10,7 @@ jest.mock('../../util/host-rules'); const ghGot: any = api.get; const hostRules: any = _hostRules; -describe('datasource/github', () => { +describe('datasource/github-tags', () => { beforeEach(() => global.renovateCache.rmAll()); describe('getDigest', () => { beforeEach(() => { @@ -61,24 +61,6 @@ describe('datasource/github', () => { }); describe('getPkgReleases', () => { beforeAll(() => global.renovateCache.rmAll()); - it('returns releases', async () => { - const body = [ - { tag_name: 'a' }, - { tag_name: 'v' }, - { tag_name: '1.0.0' }, - { tag_name: 'v1.1.0' }, - ]; - ghGot.mockReturnValueOnce({ headers: {}, body }); - const res = await github.getPkgReleases({ - lookupName: 'some/dep', - lookupType: 'releases', - }); - expect(res).toMatchSnapshot(); - expect(res.releases).toHaveLength(4); - expect( - res.releases.find(release => release.version === 'v1.1.0') - ).toBeDefined(); - }); it('returns tags', async () => { const body = [{ name: 'v1.0.0' }, { name: 'v1.1.0' }]; ghGot.mockReturnValueOnce({ headers: {}, body }); diff --git a/lib/datasource/github/index.ts b/lib/datasource/github-tags/index.ts similarity index 82% rename from lib/datasource/github/index.ts rename to lib/datasource/github-tags/index.ts index be4be995e52ba53f4565eb1674fb13441aad9778..95cc4154ba266cfcfdf0814fe7bb9054b7f82012 100644 --- a/lib/datasource/github/index.ts +++ b/lib/datasource/github-tags/index.ts @@ -4,7 +4,7 @@ import { logger } from '../../logger'; const { get: ghGot } = api; -const cacheNamespace = 'datasource-github'; +const cacheNamespace = 'datasource-github-tags'; function getCacheKey(repo: string, type: string): string { return `${repo}:${type}`; } @@ -108,42 +108,28 @@ export async function getDigest( */ export async function getPkgReleases({ lookupName: repo, - lookupType, }: PkgReleaseConfig): Promise<ReleaseResult | null> { let versions: string[]; const cachedResult = await renovateCache.get<ReleaseResult>( cacheNamespace, - getCacheKey(repo, lookupType || 'tags') + getCacheKey(repo, 'tags') ); // istanbul ignore if if (cachedResult) { return cachedResult; } try { - if (lookupType === 'releases') { - const url = `https://api.github.com/repos/${repo}/releases?per_page=100`; - type GitHubRelease = { - tag_name: string; - }[]; + // tag + const url = `https://api.github.com/repos/${repo}/tags?per_page=100`; + type GitHubTag = { + name: string; + }[]; - versions = ( - await ghGot<GitHubRelease>(url, { - paginate: true, - }) - ).body.map(o => o.tag_name); - } else { - // tag - const url = `https://api.github.com/repos/${repo}/tags?per_page=100`; - type GitHubTag = { - name: string; - }[]; - - versions = ( - await ghGot<GitHubTag>(url, { - paginate: true, - }) - ).body.map(o => o.name); - } + versions = ( + await ghGot<GitHubTag>(url, { + paginate: true, + }) + ).body.map(o => o.name); } catch (err) { logger.debug({ repo, err }, 'Error retrieving from github'); } @@ -161,7 +147,7 @@ export async function getPkgReleases({ const cacheMinutes = 10; await renovateCache.set( cacheNamespace, - getCacheKey(repo, lookupType), + getCacheKey(repo, 'tags'), dependency, cacheMinutes ); diff --git a/lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap b/lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap new file mode 100644 index 0000000000000000000000000000000000000000..614e2415393ab7f8e856a3a4ca88e95f23574914 --- /dev/null +++ b/lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`datasource/gitlab-tags getPkgReleases returns tags 1`] = ` +Object { + "releases": Array [ + Object { + "gitRef": "v1.0.0", + "version": "v1.0.0", + }, + Object { + "gitRef": "v1.1.0", + "version": "v1.1.0", + }, + ], + "sourceUrl": "https://gitlab.company.com/api/v4/undefined", +} +`; diff --git a/lib/datasource/gitlab/index.spec.ts b/lib/datasource/gitlab-tags/index.spec.ts similarity index 56% rename from lib/datasource/gitlab/index.spec.ts rename to lib/datasource/gitlab-tags/index.spec.ts index 35092cddfe7f64d536bb4e0af099144fc551f6b7..2885ee0f5219140a676ad49b5496201913a71f17 100644 --- a/lib/datasource/gitlab/index.spec.ts +++ b/lib/datasource/gitlab-tags/index.spec.ts @@ -6,31 +6,13 @@ jest.mock('../../util/got'); const glGot: any = api.get; -describe('datasource/gitlab', () => { +describe('datasource/gitlab-tags', () => { beforeEach(() => { global.repoCache = {}; return global.renovateCache.rmAll(); }); describe('getPkgReleases', () => { beforeAll(() => global.renovateCache.rmAll()); - it('returns releases', async () => { - const body = [ - { tag_name: 'a' }, - { tag_name: 'v' }, - { tag_name: '1.0.0' }, - { tag_name: 'v1.1.0' }, - ]; - glGot.mockReturnValueOnce({ headers: {}, body }); - const res = await gitlab.getPkgReleases({ - depName: 'some/dep', - lookupType: 'releases', - }); - expect(res).toMatchSnapshot(); - expect(res.releases).toHaveLength(4); - expect( - res.releases.find(release => release.version === 'v1.1.0') - ).toBeDefined(); - }); it('returns tags', async () => { const body = [{ name: 'v1.0.0' }, { name: 'v1.1.0' }]; glGot.mockReturnValueOnce({ headers: {}, body }); diff --git a/lib/datasource/gitlab/index.ts b/lib/datasource/gitlab-tags/index.ts similarity index 62% rename from lib/datasource/gitlab/index.ts rename to lib/datasource/gitlab-tags/index.ts index 53c25078d3aa1db362fefc5c3b4eb55f1de65384..d20c8a018e44c68e16409155b116167c354d2edf 100644 --- a/lib/datasource/gitlab/index.ts +++ b/lib/datasource/gitlab-tags/index.ts @@ -6,19 +6,14 @@ import { PkgReleaseConfig, ReleaseResult } from '../common'; const { get: glGot } = api; const cacheNamespace = 'datasource-gitlab'; -function getCacheKey( - depHost: string, - repo: string, - lookupType: string -): string { - const type = lookupType || 'tags'; +function getCacheKey(depHost: string, repo: string): string { + const type = 'tags'; return `${depHost}:${repo}:${type}`; } export async function getPkgReleases({ registryUrls, lookupName: repo, - lookupType, }: PkgReleaseConfig): Promise<ReleaseResult | null> { // Use registryUrls if present, otherwise default to publid gitlab.com const depHost = is.nonEmptyArray(registryUrls) @@ -27,7 +22,7 @@ export async function getPkgReleases({ let versions: string[]; const cachedResult = await renovateCache.get<ReleaseResult>( cacheNamespace, - getCacheKey(depHost, repo, lookupType) + getCacheKey(depHost, repo) ); // istanbul ignore if if (cachedResult) { @@ -37,30 +32,17 @@ export async function getPkgReleases({ const urlEncodedRepo = encodeURIComponent(repo); try { - if (lookupType === 'releases') { - const url = `${depHost}/api/v4/projects/${urlEncodedRepo}/releases?per_page=100`; - type GlRelease = { - tag_name: string; - }[]; + // tag + const url = `${depHost}/api/v4/projects/${urlEncodedRepo}/repository/tags?per_page=100`; + type GlTag = { + name: string; + }[]; - versions = ( - await glGot<GlRelease>(url, { - paginate: true, - }) - ).body.map(o => o.tag_name); - } else { - // tag - const url = `${depHost}/api/v4/projects/${urlEncodedRepo}/repository/tags?per_page=100`; - type GlTag = { - name: string; - }[]; - - versions = ( - await glGot<GlTag>(url, { - paginate: true, - }) - ).body.map(o => o.name); - } + versions = ( + await glGot<GlTag>(url, { + paginate: true, + }) + ).body.map(o => o.name); } catch (err) { // istanbul ignore next logger.debug({ repo, err }, 'Error retrieving from Gitlab'); @@ -83,7 +65,7 @@ export async function getPkgReleases({ const cacheMinutes = 10; await renovateCache.set( cacheNamespace, - getCacheKey(depHost, repo, lookupType), + getCacheKey(depHost, repo), dependency, cacheMinutes ); diff --git a/lib/datasource/gitlab/__snapshots__/index.spec.ts.snap b/lib/datasource/gitlab/__snapshots__/index.spec.ts.snap deleted file mode 100644 index 8b131abaf14976c6a33e51c6e5a909afb6a5d4b4..0000000000000000000000000000000000000000 --- a/lib/datasource/gitlab/__snapshots__/index.spec.ts.snap +++ /dev/null @@ -1,41 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`datasource/gitlab getPkgReleases returns releases 1`] = ` -Object { - "releases": Array [ - Object { - "gitRef": "a", - "version": "a", - }, - Object { - "gitRef": "v", - "version": "v", - }, - Object { - "gitRef": "1.0.0", - "version": "1.0.0", - }, - Object { - "gitRef": "v1.1.0", - "version": "v1.1.0", - }, - ], - "sourceUrl": "https://gitlab.com/undefined", -} -`; - -exports[`datasource/gitlab getPkgReleases returns tags 1`] = ` -Object { - "releases": Array [ - Object { - "gitRef": "v1.0.0", - "version": "v1.0.0", - }, - Object { - "gitRef": "v1.1.0", - "version": "v1.1.0", - }, - ], - "sourceUrl": "https://gitlab.company.com/api/v4/undefined", -} -`; diff --git a/lib/datasource/go/__snapshots__/index.spec.ts.snap b/lib/datasource/go/__snapshots__/index.spec.ts.snap index a0512c38f284bb3112acd0bfe3b9efdcfe3c7b92..6b192f230d8abadacd3fa49a607281ca1bcbe60c 100644 --- a/lib/datasource/go/__snapshots__/index.spec.ts.snap +++ b/lib/datasource/go/__snapshots__/index.spec.ts.snap @@ -17,19 +17,19 @@ exports[`datasource/go getPkgReleases works for known servers 1`] = ` Array [ Array [ Object { - "datasource": "github", + "datasource": "github-tags", "lookupName": "x/text", }, ], Array [ Object { - "datasource": "github", + "datasource": "github-tags", "lookupName": "x/text", }, ], Array [ Object { - "datasource": "github", + "datasource": "github-tags", "lookupName": "go-x/x", }, ], diff --git a/lib/datasource/go/index.spec.ts b/lib/datasource/go/index.spec.ts index e98ccd9da779ff56db183ded130cf85ba9037e4b..e55eaad4472dc54e7a1928476f14fd89e1bcb010 100644 --- a/lib/datasource/go/index.spec.ts +++ b/lib/datasource/go/index.spec.ts @@ -1,11 +1,11 @@ import _got from '../../util/got'; -import * as _github from '../github'; +import * as _github from '../github-tags'; import * as go from '.'; import { mocked, partial } from '../../../test/util'; import { ReleaseResult } from '..'; jest.mock('../../util/got'); -jest.mock('../github'); +jest.mock('../github-tags'); const got: any = mocked(_got); const github = mocked(_github); diff --git a/lib/datasource/go/index.ts b/lib/datasource/go/index.ts index eba3d02fce7d5a5e514d51b53382106d51e69484..7250073db03fd6bb8926cf69fb186afd5f97abfe 100644 --- a/lib/datasource/go/index.ts +++ b/lib/datasource/go/index.ts @@ -1,10 +1,10 @@ import { logger } from '../../logger'; import got from '../../util/got'; -import * as github from '../github'; +import * as github from '../github-tags'; import { DigestConfig, PkgReleaseConfig, ReleaseResult } from '../common'; import { regEx } from '../../util/regex'; import { - DATASOURCE_GITHUB, + DATASOURCE_GITHUB_TAGS, DATASOURCE_GO, } from '../../constants/data-binary-source'; @@ -17,15 +17,18 @@ async function getDatasource(name: string): Promise<DataSource | null> { if (name.startsWith('gopkg.in/')) { const [pkg] = name.replace('gopkg.in/', '').split('.'); if (pkg.includes('/')) { - return { datasource: DATASOURCE_GITHUB, lookupName: pkg }; + return { datasource: DATASOURCE_GITHUB_TAGS, lookupName: pkg }; } - return { datasource: DATASOURCE_GITHUB, lookupName: `go-${pkg}/${pkg}` }; + return { + datasource: DATASOURCE_GITHUB_TAGS, + lookupName: `go-${pkg}/${pkg}`, + }; } if (name.startsWith('github.com/')) { const split = name.split('/'); const lookupName = split[1] + '/' + split[2]; return { - datasource: DATASOURCE_GITHUB, + datasource: DATASOURCE_GITHUB_TAGS, lookupName, }; } @@ -44,7 +47,7 @@ async function getDatasource(name: string): Promise<DataSource | null> { logger.debug({ depName: name, goSourceUrl }, 'Go lookup source url'); if (goSourceUrl && goSourceUrl.startsWith('https://github.com/')) { return { - datasource: DATASOURCE_GITHUB, + datasource: DATASOURCE_GITHUB_TAGS, lookupName: goSourceUrl .replace('https://github.com/', '') .replace(/\/$/, ''), @@ -85,7 +88,7 @@ export async function getPkgReleases({ }: Partial<PkgReleaseConfig>): Promise<ReleaseResult | null> { logger.trace(`go.getPkgReleases(${lookupName})`); const source = await getDatasource(lookupName); - if (source && source.datasource === DATASOURCE_GITHUB) { + if (source && source.datasource === DATASOURCE_GITHUB_TAGS) { const res = await github.getPkgReleases(source); if (res && res.releases) { res.releases = res.releases.filter( @@ -112,7 +115,7 @@ export async function getDigest( value?: string ): Promise<string | null> { const source = await getDatasource(lookupName); - if (source && source.datasource === DATASOURCE_GITHUB) { + if (source && source.datasource === DATASOURCE_GITHUB_TAGS) { // ignore v0.0.0- pseudo versions that are used Go Modules - look up default branch instead const tag = value && !value.startsWith('v0.0.0-2') ? value : undefined; const digest = await github.getDigest(source, tag); diff --git a/lib/datasource/index.spec.ts b/lib/datasource/index.spec.ts index 3d964896e094a166f8222d129829d356062ede4e..d0792ecc5ee30a83f535e72bd415eef3fb944ea3 100644 --- a/lib/datasource/index.spec.ts +++ b/lib/datasource/index.spec.ts @@ -2,7 +2,7 @@ import * as datasource from '.'; import * as _npm from './npm'; import { DATASOURCE_DOCKER, - DATASOURCE_GITHUB, + DATASOURCE_GITHUB_TAGS, DATASOURCE_NPM, } from '../constants/data-binary-source'; @@ -17,9 +17,9 @@ describe('datasource/index', () => { expect(datasource.getDatasourceList()).toBeDefined(); }); it('returns if digests are supported', () => { - expect(datasource.supportsDigests({ datasource: DATASOURCE_GITHUB })).toBe( - true - ); + expect( + datasource.supportsDigests({ datasource: DATASOURCE_GITHUB_TAGS }) + ).toBe(true); }); it('returns null for no datasource', async () => { expect( diff --git a/lib/datasource/metadata.ts b/lib/datasource/metadata.ts index dbbfb36a02a3d2405edb4b2299aae50b72608fc3..b8f5818298c56f4817d8486f7ff27e63a7d553c0 100644 --- a/lib/datasource/metadata.ts +++ b/lib/datasource/metadata.ts @@ -2,7 +2,6 @@ import is from '@sindresorhus/is'; import parse from 'github-url-from-git'; import { ReleaseResult } from './common'; import * as hostRules from '../util/host-rules'; -import { DATASOURCE_GITHUB } from '../constants/data-binary-source'; // Use this object to define changelog URLs for packages // Only necessary when the changelog data cannot be found in the package's source repository @@ -112,7 +111,7 @@ export function addMetaData( } const extraBaseUrls = []; // istanbul ignore next - hostRules.hosts({ hostType: DATASOURCE_GITHUB }).forEach(host => { + hostRules.hosts({ hostType: 'github' }).forEach(host => { extraBaseUrls.push(host, `gist.${host}`); }); if (dep.sourceUrl) { diff --git a/lib/datasource/readme.md b/lib/datasource/readme.md index 9715a45355b2d964ab3c80634c69695c972ba1c8..9f81ffa05d73bdd94bb3cd870a4cf2535391ceaa 100644 --- a/lib/datasource/readme.md +++ b/lib/datasource/readme.md @@ -9,7 +9,6 @@ The minimum exported interface for a datasource is a function called `getPkgRele The config contains: - `lookupName`: the package's full name including scope if present (e.g. `@foo/bar`) -- `lookupType`: used only when there is a need to specify different types of lookups within the same datasource - `registryUrls`: an array of registry Urls to try `getPkgReleases` should return an object containing: diff --git a/lib/manager/bazel/__snapshots__/extract.spec.ts.snap b/lib/manager/bazel/__snapshots__/extract.spec.ts.snap index 906bc60e005ce37c3ac792f59a1b3a36c26c5a57..800006b3a6ba1416d5c7661f2cd479ab7ccc287e 100644 --- a/lib/manager/bazel/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/bazel/__snapshots__/extract.spec.ts.snap @@ -28,11 +28,10 @@ exports[`lib/manager/bazel/extract extractPackageFile() extracts dependencies fr Array [ Object { "currentDigest": "0356bef3fbbabec5f0e196ecfacdeb6db62d48c0", - "datasource": "github", + "datasource": "github-releases", "depName": "subpar", "depType": "http_archive", "lookupName": "google/subpar", - "lookupType": "releases", "managerData": Object { "def": "http_archive( name = \\"subpar\\", @@ -46,11 +45,10 @@ Array [ }, Object { "currentValue": "0.6.0", - "datasource": "github", + "datasource": "github-releases", "depName": "bazel_skylib", "depType": "http_archive", "lookupName": "bazelbuild/bazel-skylib", - "lookupType": "releases", "managerData": Object { "def": "http_archive( name = \\"bazel_skylib\\", @@ -68,11 +66,10 @@ exports[`lib/manager/bazel/extract extractPackageFile() extracts multiple types Array [ Object { "currentDigest": "446923c3756ceeaa75888f52fcbdd48bb314fbf8", - "datasource": "github", + "datasource": "github-releases", "depName": "distroless", "depType": "http_archive", "lookupName": "GoogleContainerTools/distroless", - "lookupType": "releases", "managerData": Object { "def": "http_archive( name=\\"distroless\\", @@ -85,11 +82,10 @@ Array [ }, Object { "currentDigest": "d665ccfa3e9c90fa789671bf4ef5f7c19c5715c4", - "datasource": "github", + "datasource": "github-releases", "depName": "bazel_toolchains", "depType": "http_archive", "lookupName": "bazelbuild/bazel-toolchains", - "lookupType": "releases", "managerData": Object { "def": "http_archive( name = \\"bazel_toolchains\\", @@ -105,11 +101,10 @@ Array [ }, Object { "currentValue": "0.7.1", - "datasource": "github", + "datasource": "github-releases", "depName": "io_bazel_rules_go", "depType": "http_archive", "lookupName": "bazelbuild/rules_go", - "lookupType": "releases", "managerData": Object { "def": "http_archive( name = \\"io_bazel_rules_go\\", @@ -121,11 +116,10 @@ Array [ }, Object { "currentValue": "0.5.0", - "datasource": "github", + "datasource": "github-releases", "depName": "bazel_skylib", "depType": "http_archive", "lookupName": "bazelbuild/bazel-skylib", - "lookupType": "releases", "managerData": Object { "def": "http_archive( name = \\"bazel_skylib\\", @@ -141,11 +135,10 @@ Array [ }, Object { "currentDigest": "446923c3756ceeaa75888f52fcbdd48bb314fbf8", - "datasource": "github", + "datasource": "github-releases", "depName": "distroless", "depType": "http_archive", "lookupName": "GoogleContainerTools/distroless", - "lookupType": "releases", "managerData": Object { "def": "http_archive( name=\\"distroless\\", @@ -203,7 +196,7 @@ Array [ }, Object { "currentValue": "0.3.1", - "datasource": "github", + "datasource": "github-releases", "depName": "build_bazel_rules_nodejs", "depType": "git_repository", "lookupName": "bazelbuild/rules_nodejs", @@ -217,7 +210,7 @@ Array [ }, Object { "currentValue": "0.6.1", - "datasource": "github", + "datasource": "github-releases", "depName": "build_bazel_rules_typescript", "depType": "git_repository", "lookupName": "bazelbuild/rules_typescript", @@ -231,7 +224,7 @@ Array [ }, Object { "currentValue": "0.0.3", - "datasource": "github", + "datasource": "github-releases", "depName": "io_bazel_rules_sass", "depType": "git_repository", "lookupName": "bazelbuild/rules_sass", @@ -245,7 +238,7 @@ Array [ }, Object { "currentDigest": "b3b620e8bcff18ed3378cd3f35ebeb7016d71f71", - "datasource": "github", + "datasource": "github-releases", "depName": "com_github_bazelbuild_buildtools", "depType": "git_repository", "lookupName": "bazelbuild/buildtools", diff --git a/lib/manager/bazel/extract.ts b/lib/manager/bazel/extract.ts index 0e84d6c00afc0237972ffc2ad2c7808d88ab3f6a..c1a36e3a54a018bc6587c17084809c9eb05170da 100644 --- a/lib/manager/bazel/extract.ts +++ b/lib/manager/bazel/extract.ts @@ -7,8 +7,8 @@ import { regEx } from '../../util/regex'; import * as dockerVersioning from '../../versioning/docker'; import { DATASOURCE_DOCKER, - DATASOURCE_GITHUB, DATASOURCE_GO, + DATASOURCE_GITHUB_RELEASES, } from '../../constants/data-binary-source'; interface UrlParsedResult { @@ -183,7 +183,7 @@ export function extractPackageFile(content: string): PackageFile | null { const githubURL = parse(remote); if (githubURL) { const repo = githubURL.substring('https://github.com/'.length); - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_RELEASES; dep.lookupName = repo; deps.push(dep); } @@ -228,9 +228,8 @@ export function extractPackageFile(content: string): PackageFile | null { } else { dep.currentValue = parsedUrl.currentValue; } - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_RELEASES; dep.lookupName = dep.repo; - dep.lookupType = 'releases'; deps.push(dep); } else if ( depType === 'container_pull' && diff --git a/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap b/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap index e29d81ad85c6834e7eb84b792c588a80310d86bb..20be1e4eaf835120da17964b532b0b4c33e748f9 100644 --- a/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/buildkite/__snapshots__/extract.spec.ts.snap @@ -33,7 +33,7 @@ exports[`lib/manager/buildkite/extract extractPackageFile() extracts arrays of p Array [ Object { "currentValue": "v2.0.1", - "datasource": "github", + "datasource": "github-tags", "depName": "docker-login", "lookupName": "buildkite-plugins/docker-login-buildkite-plugin", "managerData": Object { @@ -43,7 +43,7 @@ Array [ }, Object { "currentValue": "v2.5.1", - "datasource": "github", + "datasource": "github-tags", "depName": "docker-compose", "lookupName": "buildkite-plugins/docker-compose-buildkite-plugin", "managerData": Object { @@ -53,7 +53,7 @@ Array [ }, Object { "currentValue": "v2.0.1", - "datasource": "github", + "datasource": "github-tags", "depName": "docker-login", "lookupName": "buildkite-plugins/docker-login-buildkite-plugin", "managerData": Object { @@ -63,7 +63,7 @@ Array [ }, Object { "currentValue": "v2.5.1", - "datasource": "github", + "datasource": "github-tags", "depName": "docker-compose", "lookupName": "buildkite-plugins/docker-compose-buildkite-plugin", "managerData": Object { @@ -78,7 +78,7 @@ exports[`lib/manager/buildkite/extract extractPackageFile() extracts multiple pl Array [ Object { "currentValue": "v1.3.2", - "datasource": "github", + "datasource": "github-tags", "depName": "docker-compose", "lookupName": "buildkite-plugins/docker-compose-buildkite-plugin", "managerData": Object { @@ -88,7 +88,7 @@ Array [ }, Object { "currentValue": "v1.3.2", - "datasource": "github", + "datasource": "github-tags", "depName": "docker-compose", "lookupName": "buildkite-plugins/docker-compose-buildkite-plugin", "managerData": Object { @@ -103,7 +103,7 @@ exports[`lib/manager/buildkite/extract extractPackageFile() extracts simple sing Array [ Object { "currentValue": "v2.0.0", - "datasource": "github", + "datasource": "github-tags", "depName": "abc/detect-clowns", "lookupName": "abc/detect-clowns-buildkite-plugin", "managerData": Object { diff --git a/lib/manager/buildkite/extract.ts b/lib/manager/buildkite/extract.ts index 51b566c038550bc8d354e4a28c0a424e54f0cb64..cbaf2bc25618f2269a9fcd221530d38fe21ce577 100644 --- a/lib/manager/buildkite/extract.ts +++ b/lib/manager/buildkite/extract.ts @@ -1,7 +1,7 @@ import { logger } from '../../logger'; import { isVersion } from '../../versioning/semver'; import { PackageFile, PackageDependency } from '../common'; -import { DATASOURCE_GITHUB } from '../../constants/data-binary-source'; +import { DATASOURCE_GITHUB_TAGS } from '../../constants/data-binary-source'; export function extractPackageFile(content: string): PackageFile | null { const deps: PackageDependency[] = []; @@ -61,7 +61,7 @@ export function extractPackageFile(content: string): PackageFile | null { skipReason, }; if (repo) { - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_TAGS; dep.lookupName = repo; } deps.push(dep); diff --git a/lib/manager/common.ts b/lib/manager/common.ts index 13d79bab03eb39ce2009ff76ab4d7c08c461bb6e..c0ddd4ce6f97d7f702cfd601b4da61c07f3c47bc 100644 --- a/lib/manager/common.ts +++ b/lib/manager/common.ts @@ -134,7 +134,6 @@ export interface PackageDependency<T = Record<string, any>> extends Package<T> { digestOneAndOnly?: boolean; fromVersion?: string; lockedVersion?: string; - lookupType?: string; moduleName?: string; propSource?: string; registryUrls?: string[]; diff --git a/lib/manager/gitlabci-include/__snapshots__/extract.spec.ts.snap b/lib/manager/gitlabci-include/__snapshots__/extract.spec.ts.snap index 17b7d537df940a26060758275b2b203cf8b9a577..046e4127deaf45fc129049c17ad2c983e3cc5d14 100644 --- a/lib/manager/gitlabci-include/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/gitlabci-include/__snapshots__/extract.spec.ts.snap @@ -4,18 +4,18 @@ exports[`lib/manager/gitlabci-include/extract extractPackageFile() extracts mult Array [ Object { "currentValue": "1.0.0", - "datasource": "gitlab", + "datasource": "gitlab-tags", "depName": "mikebryant/include-source-example", "depType": "repository", }, Object { "currentValue": "master", - "datasource": "gitlab", + "datasource": "gitlab-tags", "depName": "mikebryant/include-source-example2", "depType": "repository", }, Object { - "datasource": "gitlab", + "datasource": "gitlab-tags", "depName": "mikebryant/include-source-example3", "depType": "repository", "skipReason": "unknown-version", diff --git a/lib/manager/gitlabci-include/extract.ts b/lib/manager/gitlabci-include/extract.ts index 50478052fe2ddb1f5ed0dbc7afb4591bb4e82a3b..485c7d2c11d0020eb72e59548680869e4c3e5511 100644 --- a/lib/manager/gitlabci-include/extract.ts +++ b/lib/manager/gitlabci-include/extract.ts @@ -2,7 +2,7 @@ import is from '@sindresorhus/is'; import yaml from 'js-yaml'; import { logger } from '../../logger'; import { PackageDependency, ExtractConfig, PackageFile } from '../common'; -import { DATASOURCE_GITLAB } from '../../constants/data-binary-source'; +import { DATASOURCE_GITLAB_TAGS } from '../../constants/data-binary-source'; function extractDepFromInclude(includeObj: { file: any; @@ -13,7 +13,7 @@ function extractDepFromInclude(includeObj: { return null; } const dep: PackageDependency = { - datasource: DATASOURCE_GITLAB, + datasource: DATASOURCE_GITLAB_TAGS, depName: includeObj.project, depType: 'repository', }; diff --git a/lib/manager/homebrew/__snapshots__/extract.spec.ts.snap b/lib/manager/homebrew/__snapshots__/extract.spec.ts.snap index d23a50867e79dfb154877ab7478539a3f243230b..527b908d9e6faed25f512f30183ed68860e46bf5 100644 --- a/lib/manager/homebrew/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/homebrew/__snapshots__/extract.spec.ts.snap @@ -5,7 +5,7 @@ Object { "deps": Array [ Object { "currentValue": "v0.8.2", - "datasource": "github", + "datasource": "github-tags", "depName": "bazelbuild/bazel-watcher", "managerData": Object { "ownerName": "bazelbuild", @@ -23,7 +23,7 @@ Object { "deps": Array [ Object { "currentValue": "v0.16.1", - "datasource": "github", + "datasource": "github-tags", "depName": "aide/aide", "managerData": Object { "ownerName": "aide", @@ -41,7 +41,7 @@ Object { "deps": Array [ Object { "currentValue": "v0.8.2", - "datasource": "github", + "datasource": "github-tags", "depName": "bazelbuild/bazel-watcher", "managerData": Object { "ownerName": "bazelbuild", @@ -154,7 +154,7 @@ Object { "deps": Array [ Object { "currentValue": "v0.8.2", - "datasource": "github", + "datasource": "github-tags", "depName": "bazelbuild/bazel-watcher", "managerData": Object { "ownerName": "bazelbuild", @@ -173,7 +173,7 @@ Object { "deps": Array [ Object { "currentValue": "v0.8.2", - "datasource": "github", + "datasource": "github-tags", "depName": "bazelbuild/bazel-watcher", "managerData": Object { "ownerName": "bazelbuild", diff --git a/lib/manager/homebrew/extract.ts b/lib/manager/homebrew/extract.ts index 88583b4f714a1b0b9ec2230a6bb342d25c0a2527..d106c420b3d40cee321d368489c89d26ca596b43 100644 --- a/lib/manager/homebrew/extract.ts +++ b/lib/manager/homebrew/extract.ts @@ -2,7 +2,7 @@ import { isValid } from '../../versioning/semver'; import { skip, isSpace, removeComments } from './util'; import { logger } from '../../logger'; import { PackageFile, PackageDependency } from '../common'; -import { DATASOURCE_GITHUB } from '../../constants/data-binary-source'; +import { DATASOURCE_GITHUB_TAGS } from '../../constants/data-binary-source'; function parseSha256(idx: number, content: string): string | null { let i = idx; @@ -192,7 +192,7 @@ export function extractPackageFile(content: string): PackageFile | null { depName: `${ownerName}/${repoName}`, managerData: { ownerName, repoName, sha256, url }, currentValue, - datasource: DATASOURCE_GITHUB, + datasource: DATASOURCE_GITHUB_TAGS, }; if (skipReason) { dep.skipReason = skipReason; diff --git a/lib/manager/npm/extract/__snapshots__/index.spec.ts.snap b/lib/manager/npm/extract/__snapshots__/index.spec.ts.snap index ad69beb3b925bdde2a01f54b5dd14cacaf0fb9b5..c5badfa613f2312584b00cf4af4572d653a3d3e4 100644 --- a/lib/manager/npm/extract/__snapshots__/index.spec.ts.snap +++ b/lib/manager/npm/extract/__snapshots__/index.spec.ts.snap @@ -84,7 +84,7 @@ Object { Object { "commitMessageTopic": "Node.js", "currentValue": ">= 8.9.2", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "depType": "engines", "lookupName": "nodejs/node", @@ -149,7 +149,7 @@ Object { Object { "currentRawValue": "github:owner/c#v1.1.0", "currentValue": "v1.1.0", - "datasource": "github", + "datasource": "github-tags", "depName": "c", "depType": "dependencies", "gitRef": true, @@ -170,7 +170,7 @@ Object { "currentDigest": "49b5aca613b33c5b626ae68c03a385f25c142f55", "currentRawValue": "github:owner/e#49b5aca613b33c5b626ae68c03a385f25c142f55", "currentValue": null, - "datasource": "github", + "datasource": "github-tags", "depName": "e", "depType": "dependencies", "gitRef": true, @@ -182,7 +182,7 @@ Object { Object { "currentRawValue": "owner/f#v2.0.0", "currentValue": "v2.0.0", - "datasource": "github", + "datasource": "github-tags", "depName": "f", "depType": "dependencies", "gitRef": true, @@ -224,7 +224,7 @@ Object { "currentDigest": "49b5aca", "currentRawValue": "github:owner/k#49b5aca", "currentValue": null, - "datasource": "github", + "datasource": "github-tags", "depName": "k", "depType": "dependencies", "gitRef": true, @@ -237,7 +237,7 @@ Object { "currentDigest": "abcdef0", "currentRawValue": "github:owner/l.git#abcdef0", "currentValue": null, - "datasource": "github", + "datasource": "github-tags", "depName": "l", "depType": "dependencies", "gitRef": true, @@ -249,7 +249,7 @@ Object { Object { "currentRawValue": "https://github.com/owner/m.git#v1.0.0", "currentValue": "v1.0.0", - "datasource": "github", + "datasource": "github-tags", "depName": "m", "depType": "dependencies", "gitRef": true, @@ -262,7 +262,7 @@ Object { Object { "currentRawValue": "git+https://github.com/owner/n#v2.0.0", "currentValue": "v2.0.0", - "datasource": "github", + "datasource": "github-tags", "depName": "n", "depType": "dependencies", "gitRef": true, @@ -343,7 +343,7 @@ Object { Object { "commitMessageTopic": "Node.js", "currentValue": "8.9.2", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "depType": "engines", "lookupName": "nodejs/node", @@ -356,7 +356,7 @@ Object { Object { "commitMessageTopic": "Node.js", "currentValue": "8.9.2", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "depType": "volta", "lookupName": "nodejs/node", @@ -405,7 +405,7 @@ Object { Object { "commitMessageTopic": "Node.js", "currentValue": "8.9.2", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "depType": "engines", "lookupName": "nodejs/node", @@ -418,7 +418,7 @@ Object { Object { "commitMessageTopic": "Node.js", "currentValue": "8.9.2", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "depType": "volta", "lookupName": "nodejs/node", diff --git a/lib/manager/npm/extract/index.ts b/lib/manager/npm/extract/index.ts index 9ac32972fad5a5a47c1466a05459906f7fabdccc..8c871e1d1b18bb7aa241e7f313c68b49b55babc4 100644 --- a/lib/manager/npm/extract/index.ts +++ b/lib/manager/npm/extract/index.ts @@ -19,7 +19,7 @@ import { platform } from '../../../platform'; import { CONFIG_VALIDATION } from '../../../constants/error-messages'; import * as nodeVersioning from '../../../versioning/node'; import { - DATASOURCE_GITHUB, + DATASOURCE_GITHUB_TAGS, DATASOURCE_NPM, } from '../../../constants/data-binary-source'; @@ -156,7 +156,7 @@ export async function extractPackageFile( dep.currentValue = input.trim(); if (depType === 'engines') { if (depName === 'node') { - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_TAGS; dep.lookupName = 'nodejs/node'; dep.versioning = nodeVersioning.id; } else if (depName === 'yarn') { @@ -177,7 +177,7 @@ export async function extractPackageFile( // support for volta if (depType === 'volta') { if (depName === 'node') { - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_TAGS; dep.lookupName = 'nodejs/node'; dep.versioning = nodeVersioning.id; } else if (depName === 'yarn') { @@ -248,7 +248,7 @@ export async function extractPackageFile( if (isVersion(depRefPart)) { dep.currentRawValue = dep.currentValue; dep.currentValue = depRefPart; - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_TAGS; dep.lookupName = githubOwnerRepo; dep.pinDigests = false; } else if ( @@ -258,7 +258,7 @@ export async function extractPackageFile( dep.currentRawValue = dep.currentValue; dep.currentValue = null; dep.currentDigest = depRefPart; - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_TAGS; dep.lookupName = githubOwnerRepo; } else { dep.skipReason = 'unversioned-reference'; diff --git a/lib/manager/nvm/__snapshots__/extract.spec.ts.snap b/lib/manager/nvm/__snapshots__/extract.spec.ts.snap index 02783992f7b11147b962660c092ff7f7dc075151..59da23812c9e12d3e0951c1f4210ae61e34c4af8 100644 --- a/lib/manager/nvm/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/nvm/__snapshots__/extract.spec.ts.snap @@ -4,7 +4,7 @@ exports[`lib/manager/nvm/extract extractPackageFile() returns a result 1`] = ` Array [ Object { "currentValue": "8.4.0", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "lookupName": "nodejs/node", }, @@ -15,7 +15,7 @@ exports[`lib/manager/nvm/extract extractPackageFile() skips non ranges 1`] = ` Array [ Object { "currentValue": "latestn", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "lookupName": "nodejs/node", "skipReason": "unsupported-version", @@ -27,7 +27,7 @@ exports[`lib/manager/nvm/extract extractPackageFile() supports ranges 1`] = ` Array [ Object { "currentValue": "8.4", - "datasource": "github", + "datasource": "github-tags", "depName": "node", "lookupName": "nodejs/node", }, diff --git a/lib/manager/nvm/extract.ts b/lib/manager/nvm/extract.ts index e40f7d1801b069c7b49b678d939236e0ecf89501..f327e4c4afd15cca25a6e0db0b5519e0445fa468 100644 --- a/lib/manager/nvm/extract.ts +++ b/lib/manager/nvm/extract.ts @@ -1,12 +1,12 @@ import { isValid } from '../../versioning/node'; import { PackageFile, PackageDependency } from '../common'; -import { DATASOURCE_GITHUB } from '../../constants/data-binary-source'; +import { DATASOURCE_GITHUB_TAGS } from '../../constants/data-binary-source'; export function extractPackageFile(content: string): PackageFile { const dep: PackageDependency = { depName: 'node', currentValue: content.trim(), - datasource: DATASOURCE_GITHUB, + datasource: DATASOURCE_GITHUB_TAGS, lookupName: 'nodejs/node', }; if (!isValid(dep.currentValue)) { diff --git a/lib/manager/terraform/__snapshots__/extract.spec.ts.snap b/lib/manager/terraform/__snapshots__/extract.spec.ts.snap index e14e00e7a52d4d74767b3e993b4c50734823f511..cd5b1e0f9f8c42a43077bb0adc863b131661d3d3 100644 --- a/lib/manager/terraform/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/terraform/__snapshots__/extract.spec.ts.snap @@ -5,7 +5,7 @@ Object { "deps": Array [ Object { "currentValue": "v1.0.0", - "datasource": "github", + "datasource": "github-tags", "depName": "github.com/hashicorp/example", "depNameShort": "hashicorp/example", "depType": "github", @@ -19,7 +19,7 @@ Object { }, Object { "currentValue": "next", - "datasource": "github", + "datasource": "github-tags", "depName": "github.com/hashicorp/example", "depNameShort": "hashicorp/example", "depType": "github", @@ -47,7 +47,7 @@ Object { }, Object { "currentValue": "v0.1.0", - "datasource": "github", + "datasource": "github-tags", "depName": "github.com/tieto-cem/terraform-aws-ecs-task-definition", "depNameShort": "tieto-cem/terraform-aws-ecs-task-definition", "depType": "github", @@ -61,7 +61,7 @@ Object { }, Object { "currentValue": "v0.1.0", - "datasource": "github", + "datasource": "github-tags", "depName": "github.com/tieto-cem/terraform-aws-ecs-task-definition", "depNameShort": "tieto-cem/terraform-aws-ecs-task-definition", "depType": "github", @@ -75,7 +75,7 @@ Object { }, Object { "currentValue": "v2.0.0", - "datasource": "github", + "datasource": "github-tags", "depName": "github.com/hashicorp/example", "depNameShort": "hashicorp/example", "depType": "github", diff --git a/lib/manager/terraform/extract.ts b/lib/manager/terraform/extract.ts index 1896c6a3563f51492b1083eb746691fb55a6fc16..c7e4d33545a98047df5d7ea71742197c00fb16cd 100644 --- a/lib/manager/terraform/extract.ts +++ b/lib/manager/terraform/extract.ts @@ -3,7 +3,7 @@ import { isValid, isVersion } from '../../versioning/hashicorp'; import { PackageDependency, PackageFile } from '../common'; import { DATASOURCE_GIT_TAGS, - DATASOURCE_GITHUB, + DATASOURCE_GITHUB_TAGS, DATASOURCE_TERRAFORM, DATASOURCE_TERRAFORM_PROVIDER, } from '../../constants/data-binary-source'; @@ -99,7 +99,7 @@ export function extractPackageFile(content: string): PackageFile | null { dep.depName = 'github.com/' + githubRefMatch[2]; dep.depNameShort = githubRefMatch[2]; dep.currentValue = githubRefMatch[3]; - dep.datasource = DATASOURCE_GITHUB; + dep.datasource = DATASOURCE_GITHUB_TAGS; dep.lookupName = githubRefMatch[2]; dep.managerData.lineNumber = dep.sourceLine; if (!isVersion(dep.currentValue)) { diff --git a/lib/manager/travis/package.spec.ts b/lib/manager/travis/package.spec.ts index 1e89c097f0ab6daf20d51cdeec15183aac365ed6..1c24e908c426fe2f5efb9fecb05db87787d566d8 100644 --- a/lib/manager/travis/package.spec.ts +++ b/lib/manager/travis/package.spec.ts @@ -1,11 +1,11 @@ import { getPackageUpdates } from './package'; -import { getPkgReleases as _getPkgReleases } from '../../datasource/github'; +import { getPkgReleases as _getPkgReleases } from '../../datasource/github-tags'; import { getConfig } from '../../config/defaults'; const defaultConfig = getConfig(); const getPkgReleases: any = _getPkgReleases; -jest.mock('../../datasource/github'); +jest.mock('../../datasource/github-tags'); describe('lib/manager/travis/package', () => { describe('getPackageUpdates', () => { diff --git a/lib/manager/travis/package.ts b/lib/manager/travis/package.ts index c18b03bdf84845a5e718f076a76090d7e7671187..8165cd612869150afd4e8663f1074654aa527492 100644 --- a/lib/manager/travis/package.ts +++ b/lib/manager/travis/package.ts @@ -5,6 +5,7 @@ import { getPkgReleases } from '../../datasource'; import { isVersion, maxSatisfyingVersion } from '../../versioning/semver'; import nodeJsSchedule from '../../../data/node-js-schedule.json'; import { PackageUpdateConfig, PackageUpdateResult } from '../common'; +import { DATASOURCE_GITHUB_TAGS } from '../../constants/data-binary-source'; interface NodeJsPolicies { all: number[]; @@ -101,7 +102,7 @@ export async function getPackageUpdates( const versions = ( await getPkgReleases({ ...config, - datasource: 'github', + datasource: DATASOURCE_GITHUB_TAGS, depName: 'nodejs/node', }) ).releases.map(release => release.version); diff --git a/test/workers/repository/process/lookup/index.spec.ts b/test/workers/repository/process/lookup/index.spec.ts index 79d3945f4da8db5c998a67427c629a9a05fd82b7..4aedc83167d45fd727c2ad6d1262b67b4e7c73c3 100644 --- a/test/workers/repository/process/lookup/index.spec.ts +++ b/test/workers/repository/process/lookup/index.spec.ts @@ -19,7 +19,7 @@ import * as pep440Versioning from '../../../../../lib/versioning/pep440'; import { DATASOURCE_DOCKER, DATASOURCE_GIT_SUBMODULES, - DATASOURCE_GITHUB, + DATASOURCE_GITHUB_TAGS, DATASOURCE_NPM, DATASOURCE_PACKAGIST, DATASOURCE_PYPI, @@ -989,7 +989,7 @@ describe('workers/repository/process/lookup', () => { }); it('handles github 404', async () => { config.depName = 'foo'; - config.datasource = DATASOURCE_GITHUB; + config.datasource = DATASOURCE_GITHUB_TAGS; config.packageFile = 'package.json'; config.currentValue = '1.0.0'; nock('https://pypi.org')