diff --git a/lib/platform/github/gh-got-wrapper.js b/lib/platform/github/gh-got-wrapper.js index 8219e96389c5abf394c1bb5cf8de0e98fff4618d..24d972574547988c5838d33eb1c513444f8b3967 100644 --- a/lib/platform/github/gh-got-wrapper.js +++ b/lib/platform/github/gh-got-wrapper.js @@ -135,6 +135,7 @@ get.setAppMode = function setAppMode(val) { }; get.reset = function reset() { + cache = null; cache = {}; }; diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 04ff5591e01606893ba54bf4790a20d30d5fbb0e..b9982f1239fa3c0814b99007faec9608c9172c92 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -10,6 +10,7 @@ let config = {}; module.exports = { // Initialization getRepos, + cleanRepo, initRepo, getRepoForceRebase, setBaseBranch, @@ -70,6 +71,22 @@ async function getRepos(token, endpoint) { } } +function cleanRepo() { + // In theory most of this isn't necessary. In practice.. + get.reset(); + config = null; + config = {}; + delete config.repository; + delete config.owner; + delete config.defaultBranch; + delete config.baseBranch; + delete config.issueList; + delete config.prList; + delete config.fileList; + delete config.branchList; + delete config.forkToken; +} + // Initialize GitHub by getting base branch and SHA async function initRepo({ repository, @@ -92,8 +109,7 @@ async function initRepo({ } logger.debug('Resetting platform config'); // config is used by the platform api itself, not necessary for the app layer to know - config = {}; - get.reset(); + cleanRepo(); config.repository = repository; // platformConfig is passed back to the app layer and contains info about the platform they require const platformConfig = {}; diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 8ec72973e1bf14f452916feb3cdabcd81f1d0640..47ab4915af4d8f246abdf40461a7484490c9b2f6 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -5,6 +5,7 @@ let config = {}; module.exports = { getRepos, + cleanRepo: () => undefined, initRepo, getRepoForceRebase, setBaseBranch, diff --git a/lib/platform/vsts/index.js b/lib/platform/vsts/index.js index f3b021a43fef9c6a1de98daf354712a6bf809c98..05f4f38e3d1907bc6d94480e5c19f5c7eec10982 100644 --- a/lib/platform/vsts/index.js +++ b/lib/platform/vsts/index.js @@ -7,6 +7,7 @@ const config = {}; module.exports = { // Initialization getRepos, + cleanRepo: () => undefined, initRepo, getRepoForceRebase, setBaseBranch, diff --git a/lib/workers/repository/index.js b/lib/workers/repository/index.js index d6954edf6363d00593dc421604f7a7e176bef30b..6e3cdad6ecbb5ab7345e661d4d25d4352a178bd6 100644 --- a/lib/workers/repository/index.js +++ b/lib/workers/repository/index.js @@ -95,6 +95,7 @@ async function renovateRepository(repoConfig, token, loop = 1) { ? commonConfig.branchPrefix : config.branchPrefix; await pruneStaleBranches(config); + platform.cleanRepo(); logger.info('Finished repository'); } } diff --git a/test/platform/__snapshots__/index.spec.js.snap b/test/platform/__snapshots__/index.spec.js.snap index 0543b2fb6e3ccfd68643a64e0609a65c41e530b9..e7232e687d0f12771f02b1be4d41ff2ed43727b9 100644 --- a/test/platform/__snapshots__/index.spec.js.snap +++ b/test/platform/__snapshots__/index.spec.js.snap @@ -3,6 +3,7 @@ exports[`platform has a list of supported methods for github 1`] = ` Array [ "getRepos", + "cleanRepo", "initRepo", "getRepoForceRebase", "setBaseBranch", @@ -39,6 +40,7 @@ Array [ exports[`platform has a list of supported methods for gitlab 1`] = ` Array [ "getRepos", + "cleanRepo", "initRepo", "getRepoForceRebase", "setBaseBranch", @@ -75,6 +77,7 @@ Array [ exports[`platform has a list of supported methods for vsts 1`] = ` Array [ "getRepos", + "cleanRepo", "initRepo", "getRepoForceRebase", "setBaseBranch", diff --git a/test/platform/gitlab/index.spec.js b/test/platform/gitlab/index.spec.js index 959892aee5260e38e7c445d68f1d4a6ccdcfcffd..d5544904f525b7707813725168ed62e6328dd991 100644 --- a/test/platform/gitlab/index.spec.js +++ b/test/platform/gitlab/index.spec.js @@ -60,7 +60,11 @@ describe('platform/gitlab', () => { expect(repos).toMatchSnapshot(); }); }); - + describe('cleanRepo()', () => { + it('exists', () => { + gitlab.cleanRepo(); + }); + }); function initRepo(...args) { // projects/${config.repository get.mockImplementationOnce(() => ({ diff --git a/test/platform/vsts/index.spec.js b/test/platform/vsts/index.spec.js index eb0a81f047f550554a793ba36b2edc16dc0bb1a7..42bae976192d2ddf56e0d586a337bd3a54fc8719 100644 --- a/test/platform/vsts/index.spec.js +++ b/test/platform/vsts/index.spec.js @@ -46,7 +46,11 @@ describe('platform/vsts', () => { expect(repos).toMatchSnapshot(); }); }); - + describe('cleanRepo()', () => { + it('exists', () => { + vsts.cleanRepo(); + }); + }); function initRepo(...args) { vstsApi.gitApi.mockImplementationOnce(() => ({ getRepositories: jest.fn(() => [