mirror of https://github.com/renovatebot/renovate
fix: revert docker/meteor onboarding code (#916)
* Revert "feat: support docker and meteor onboarding without npm"
This reverts commit 437145b901
.
# Conflicts:
# test/workers/repository/onboarding.spec.js
* chore: downgrade npm cache message from debug to trace
pull/917/head
v9.72.4
parent
68bcb5e726
commit
e9ee8002df
lib
api
workers/repository
test/workers/repository
|
@ -54,7 +54,7 @@ async function getDependency(name, logger) {
|
|||
// Return from cache if present
|
||||
const cacheVal = await cache.get(cacheKey);
|
||||
if (cacheVal) {
|
||||
logger.debug(`Returning cached version of ${name}`);
|
||||
logger.trace(`Returning cached version of ${name}`);
|
||||
return cacheVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ async function renovateRepository(repoConfig, token) {
|
|||
logger.warn(message);
|
||||
}
|
||||
}
|
||||
config.repoIsOnboarded = await onboarding.getOnboardingStatus(config);
|
||||
// Detect package files in default branch if not manually provisioned
|
||||
if (config.packageFiles.length === 0) {
|
||||
logger.debug('Detecting package files');
|
||||
|
@ -85,6 +84,7 @@ async function renovateRepository(repoConfig, token) {
|
|||
logger.trace({ config }, 'post-packageFiles config');
|
||||
// TODO: why is this fix needed?!
|
||||
config.logger = logger;
|
||||
config.repoIsOnboarded = await onboarding.getOnboardingStatus(config);
|
||||
if (!config.repoIsOnboarded) {
|
||||
config.contentBaseBranch = `${config.branchPrefix}configure`;
|
||||
// Remove packageFile list in case they are provisioned in renovate.json
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
const apis = require('./apis');
|
||||
|
||||
const onboardPrTitle = 'Configure Renovate';
|
||||
|
||||
module.exports = {
|
||||
|
@ -25,24 +23,15 @@ async function isRepoPrivate(config) {
|
|||
async function createBranch(config) {
|
||||
const { logger } = config;
|
||||
const onboardBranchName = `${config.branchPrefix}configure`;
|
||||
let extendsStr;
|
||||
const repoIsPrivate = await module.exports.isRepoPrivate(config);
|
||||
let onboardingConfig = { ...config };
|
||||
onboardingConfig.meteor.enabled = true;
|
||||
onboardingConfig.docker.enabled = true;
|
||||
onboardingConfig = await apis.detectPackageFiles(onboardingConfig);
|
||||
if (onboardingConfig.types.npm) {
|
||||
extendsStr = repoIsPrivate ? '"config:js-app"' : '"config:js-lib"';
|
||||
let onboardingConfigString;
|
||||
if (repoIsPrivate) {
|
||||
logger.debug('Repo is private - setting to app type');
|
||||
onboardingConfigString = `{\n "extends": ["config:js-app"]\n}\n`;
|
||||
} else {
|
||||
extendsStr = '"config:base"';
|
||||
logger.debug('Repo is not private - setting to library');
|
||||
onboardingConfigString = `{\n "extends": ["config:js-lib"]\n}\n`;
|
||||
}
|
||||
if (onboardingConfig.types.meteor) {
|
||||
extendsStr += ', ":meteor"';
|
||||
}
|
||||
if (onboardingConfig.types.docker) {
|
||||
extendsStr += ', ":docker"';
|
||||
}
|
||||
const onboardingConfigString = `{\n "extends": [${extendsStr}]\n}\n`;
|
||||
const existingContent = await config.api.getFileContent(
|
||||
'renovate.json',
|
||||
onboardBranchName
|
||||
|
|
|
@ -415,19 +415,3 @@ Array [
|
|||
"Add renovate.json",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`lib/workers/repository/onboarding getOnboardingStatus(config) uses config:base if no npm 1`] = `
|
||||
Array [
|
||||
"renovate/configure",
|
||||
Array [
|
||||
Object {
|
||||
"contents": "{
|
||||
\\"extends\\": [\\"config:base\\", \\":meteor\\", \\":docker\\"]
|
||||
}
|
||||
",
|
||||
"name": "renovate.json",
|
||||
},
|
||||
],
|
||||
"Add renovate.json",
|
||||
]
|
||||
`;
|
||||
|
|
|
@ -101,7 +101,7 @@ describe('workers/repository', () => {
|
|||
...{ packageFiles: [] },
|
||||
}));
|
||||
await repositoryWorker.renovateRepository(config);
|
||||
expect(apis.resolvePackageFiles.mock.calls.length).toBe(0);
|
||||
expect(onboarding.getOnboardingStatus.mock.calls.length).toBe(0);
|
||||
expect(config.logger.error.mock.calls.length).toBe(0);
|
||||
});
|
||||
it('does not skip repository if package.json', async () => {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
const apis = require('../../../lib/workers/repository/apis');
|
||||
const onboarding = require('../../../lib/workers/repository/onboarding');
|
||||
const logger = require('../../_fixtures/logger');
|
||||
const defaultConfig = require('../../../lib/config/defaults').getConfig();
|
||||
|
@ -223,7 +222,6 @@ describe('lib/workers/repository/onboarding', () => {
|
|||
beforeEach(() => {
|
||||
config = { ...defaultConfig };
|
||||
jest.resetAllMocks();
|
||||
apis.detectPackageFiles = jest.fn(a => a);
|
||||
config.api = {
|
||||
commitFilesToBranch: jest.fn(),
|
||||
createPr: jest.fn(() => ({ displayNumber: 1 })),
|
||||
|
@ -234,7 +232,6 @@ describe('lib/workers/repository/onboarding', () => {
|
|||
};
|
||||
config.foundIgnoredPaths = true;
|
||||
config.logger = logger;
|
||||
config.types = { npm: true };
|
||||
config.detectedPackageFiles = true;
|
||||
onboarding.isRepoPrivate = jest.fn();
|
||||
});
|
||||
|
@ -282,16 +279,6 @@ describe('lib/workers/repository/onboarding', () => {
|
|||
expect(config.api.commitFilesToBranch.mock.calls.length).toBe(1);
|
||||
expect(config.api.commitFilesToBranch.mock.calls[0]).toMatchSnapshot();
|
||||
});
|
||||
it('uses config:base if no npm', async () => {
|
||||
config.types.npm = false;
|
||||
config.types.meteor = true;
|
||||
config.types.docker = true;
|
||||
const res = await onboarding.getOnboardingStatus(config);
|
||||
expect(res).toEqual(false);
|
||||
expect(config.api.findPr.mock.calls.length).toBe(1);
|
||||
expect(config.api.commitFilesToBranch.mock.calls.length).toBe(1);
|
||||
expect(config.api.commitFilesToBranch.mock.calls[0]).toMatchSnapshot();
|
||||
});
|
||||
it('pins private repos', async () => {
|
||||
onboarding.isRepoPrivate.mockReturnValueOnce(true);
|
||||
const res = await onboarding.getOnboardingStatus(config);
|
||||
|
|
Loading…
Reference in New Issue