Skip to content

Commit

Permalink
chore(land): remove lite-ci checks
Browse files Browse the repository at this point in the history
Lite CI is not used anymore, but some PRs got Lite-CI runs after some
changes to the bot. node-core-utils Lite-CI parsing is not working
though, therefore ncu will fail to land those PRs. Removing Lite-CI
checks fix the issue and also reduces complexity.

Fix: nodejs#466
  • Loading branch information
mmarchini committed Aug 14, 2020
1 parent 2c293b0 commit 4b32ebc
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 125 deletions.
37 changes: 2 additions & 35 deletions lib/ci/ci_type_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ const LIBUV = 'LIBUV';
const NOINTL = 'NOINTL';
const V8 = 'V8';
const LINTER = 'LINTER';
const LITE_PR = 'LITE_PR';
const LITE_PR_PIPELINE = 'LITE_PR_PIPELINE';
const LITE_COMMIT = 'LITE_COMMIT';
const DAILY_MASTER = 'DAILY_MASTER';

const CI_TYPE_ENUM = {
FULL_CI: 1 << 0,
LITE_CI: 1 << 1,
JOB_CI: 1 << 2
};

Expand All @@ -33,7 +29,7 @@ const CI_PROVIDERS = {
GITHUB: 'github-check'
};

const { JOB_CI, FULL_CI, LITE_CI } = CI_TYPE_ENUM;
const { JOB_CI, FULL_CI } = CI_TYPE_ENUM;

const CI_TYPES = new Map([
[CITGM, {
Expand All @@ -46,7 +42,7 @@ const CI_TYPES = new Map([
name: 'CITGM',
jobName: 'citgm-smoker-nobuild',
pattern: /job\/citgm-smoker-nobuild\/(\d+)/,
type: JOB_CI | LITE_CI
type: JOB_CI
}],
[PR, {
name: 'Full PR',
Expand Down Expand Up @@ -90,24 +86,6 @@ const CI_TYPES = new Map([
pattern: /job\/node-test-linter\/(\d+)/,
type: JOB_CI
}],
[LITE_PR, {
name: 'Lite PR',
jobName: 'node-test-pull-request-lite',
pattern: /job\/node-test-pull-request-lite\/(\d+)/,
type: JOB_CI | LITE_CI
}],
[LITE_PR_PIPELINE, {
name: 'Lite PR Pipeline',
jobName: 'node-test-pull-request-lite-pipeline',
pattern: /node-test-pull-request-lite-pipeline\/(\d+)/,
type: LITE_CI
}],
[LITE_COMMIT, {
name: 'Lite Commit',
jobName: 'node-test-commit-lite',
pattern: /job\/node-test-commit-lite\/(\d+)/,
type: JOB_CI | LITE_CI
}],
[DAILY_MASTER, {
name: 'Node Daily Master',
jobName: 'node-daily-master',
Expand All @@ -124,14 +102,6 @@ function isFullCI(key) {
return !!(data.type & FULL_CI);
}

function isLiteCI(key) {
const data = CI_TYPES.get(key);
if (!data) {
return false;
}
return !!(data.type & LITE_CI);
}

// Given a ci.nodejs.org/*** link, parse the job type and ID
function parseJobFromURL(url) {
if (typeof url !== 'string') {
Expand Down Expand Up @@ -234,13 +204,10 @@ module.exports = {
V8,
NOINTL,
LINTER,
LITE_PR,
LITE_COMMIT,
DAILY_MASTER
},
CI_PROVIDERS,
isFullCI,
isLiteCI,
JobParser,
parseJobFromURL
};
9 changes: 4 additions & 5 deletions lib/pr_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const {
JobParser,
CI_TYPES,
CI_PROVIDERS,
isLiteCI,
isFullCI
} = require('./ci/ci_type_parser');
const { PRBuild } = require('./ci/build-types/pr_build');
Expand Down Expand Up @@ -199,9 +198,9 @@ class PRChecker {
}
}

hasFullOrLiteCI(ciMap) {
hasFullCI(ciMap) {
const cis = [...ciMap.keys()];
return cis.find(ci => isFullCI(ci) || isLiteCI(ci));
return cis.find(isFullCI);
}

async checkCI() {
Expand Down Expand Up @@ -237,9 +236,9 @@ class PRChecker {
cli.error('No CI runs detected');
this.CIStatus = false;
return false;
} else if (!this.hasFullOrLiteCI(ciMap)) {
} else if (!this.hasFullCI(ciMap)) {
status = false;
cli.error('No full or lite Jenkins CI runs detected');
cli.error('No full Jenkins CI runs detected');
}

let lastCI;
Expand Down
8 changes: 0 additions & 8 deletions test/fixtures/comments_with_ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,5 @@
{
"publishedAt": "2017-10-27T04:16:36.458Z",
"bodyText": "Linter CI: https://ci.nodejs.org/job/node-test-linter/13127/"
},
{
"publishedAt": "2017-10-28T04:16:36.458Z",
"bodyText": "CI https://ci.nodejs.org/job/node-test-commit-lite/246/"
},
{
"publishedAt": "2017-10-29T04:16:36.458Z",
"bodyText": "@contributer build started: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/7213/pipeline/"
}
]
6 changes: 0 additions & 6 deletions test/fixtures/comments_with_lite_ci.json

This file was deleted.

3 changes: 0 additions & 3 deletions test/fixtures/commits_after_ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,5 @@
"comment": [{
"bodyText": "CI: https://ci.nodejs.org/job/node-test-pull-request/10984/",
"publishedAt": "2017-10-24T11:19:25Z"
},{
"bodyText": "Lite-CI: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/10984",
"publishedAt": "2017-10-22T11:19:25Z"
}]
}
2 changes: 0 additions & 2 deletions test/fixtures/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const noReviewers = {
const approvingReviews = readJSON('reviews_approved.json');
const requestingChangesReviews = readJSON('reviews_requesting_changes.json');

const commentsWithLiteCI = readJSON('comments_with_lite_ci.json');
const commentsWithCI = readJSON('comments_with_ci.json');
const commentsWithLGTM = readJSON('comments_with_lgtm.json');

Expand Down Expand Up @@ -110,7 +109,6 @@ module.exports = {
approvingReviews,
requestingChangesReviews,
commentsWithCI,
commentsWithLiteCI,
commentsWithLGTM,
oddCommits,
githubCI,
Expand Down
24 changes: 0 additions & 24 deletions test/unit/ci_type_parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,11 @@ const expected = new Map([
link: 'https://ci.nodejs.org/job/node-test-linter/13127/',
date: '2017-10-27T04:16:36.458Z',
jobid: 13127
}],
['LITE_COMMIT', {
link: 'https://ci.nodejs.org/job/node-test-commit-lite/246/',
date: '2017-10-28T04:16:36.458Z',
jobid: 246
}],
['LITE_PR_PIPELINE', {
link: 'https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/7213/pipeline/',
date: '2017-10-29T04:16:36.458Z',
jobid: 7213
}]
]);
describe('JobParser', () => {
it('should parse CI results', () => {
const results = new JobParser(commentsWithCI).parse();
assert.deepStrictEqual([...results.entries()], [...expected.entries()]);
});

it('should parse pipeline links', () => {
const data = [{
publishedAt: '2017-10-29T04:16:36.458Z',
bodyText: '@contributer build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/3009/pipeline/'
}];
const results = new JobParser(data).parse();
assert.deepStrictEqual([...results.entries()], [
['LITE_PR_PIPELINE', {
link: 'https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/3009/pipeline/',
date: '2017-10-29T04:16:36.458Z',
jobid: 3009
}]]);
});
});
42 changes: 0 additions & 42 deletions test/unit/pr_checker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const {
requestingChangesReviews,
noReviewers,
commentsWithCI,
commentsWithLiteCI,
commentsWithLGTM,
singleCommitAfterReview,
multipleCommitsAfterReview,
Expand Down Expand Up @@ -675,14 +674,6 @@ describe('PRChecker', () => {
[
'Last Linter CI on 2017-10-27T04:16:36.458Z: ' +
'https://ci.nodejs.org/job/node-test-linter/13127/'
],
[
'Last Lite Commit CI on 2017-10-28T04:16:36.458Z: ' +
'https://ci.nodejs.org/job/node-test-commit-lite/246/'
],
[
'Last Lite PR Pipeline CI on 2017-10-29T04:16:36.458Z: ' +
'https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/7213/pipeline/'
]
]
};
Expand Down Expand Up @@ -720,7 +711,6 @@ describe('PRChecker', () => {
['- feat: add something']
],
info: [
['Last Lite PR Pipeline CI on 2017-10-22T11:19:25Z: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/10984'],
['Last Full PR CI on 2017-10-24T11:19:25Z: https://ci.nodejs.org/job/node-test-pull-request/10984/']
]
};
Expand Down Expand Up @@ -824,38 +814,6 @@ describe('PRChecker', () => {
ignore: ['startSpinner', 'updateSpinner', 'stopSpinner']
});
});

it('should count LITE CI as valid ci requirement', async() => {
const cli = new TestCLI();

const expectedLogs = {
info: [
[
'Last Lite Commit CI on 2018-02-09T21:38:30Z: ' +
'https://ci.nodejs.org/job/node-test-commit-lite/246/'
]
]
};

const checker = new PRChecker(cli, {
pr: firstTimerPR,
reviewers: allGreenReviewers,
comments: commentsWithLiteCI,
reviews: approvingReviews,
commits: [],
collaborators,
authorIsNew: () => true,
getThread() {
return PRData.prototype.getThread.call(this);
}
}, {}, { maxCommits: 0 });

const status = await checker.checkCI();
assert(status);
cli.assertCalledWith(expectedLogs, {
ignore: ['startSpinner', 'updateSpinner', 'stopSpinner']
});
});
});

describe('checkGitHubCI', () => {
Expand Down

0 comments on commit 4b32ebc

Please sign in to comment.