Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 51fdcbf

Browse files
committed
Initial commit
1 parent 29ca0de commit 51fdcbf

File tree

1,426 files changed

+174974
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,426 files changed

+174974
-0
lines changed

.circleci/config.yml

Lines changed: 971 additions & 0 deletions
Large diffs are not rendered by default.

.circleci/deps-audit-report.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
const fs = require('fs');
2+
const { exec } = require("child_process");
3+
4+
const FILENAME = process.env.FILENAME;
5+
const DEPS = process.env.DEPS || '';
6+
const file = `${FILENAME}`;
7+
const outputFile = `slack.${FILENAME}`;
8+
9+
function generateSlackMessage (summary) {
10+
const message = {
11+
text: `DEPS AUDIT: *${DEPS}* result (Branch: *${process.env.CIRCLE_BRANCH}*)` +
12+
`\nScanned ${summary.totalDependencies} dependencies` +
13+
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
14+
attachments: [],
15+
};
16+
17+
if (summary.totalVulnerabilities) {
18+
if (summary.vulnerabilities.critical) {
19+
message.attachments.push({
20+
title: 'Critical',
21+
color: '#641E16',
22+
text: `${summary.vulnerabilities.critical}`,
23+
});
24+
}
25+
if (summary.vulnerabilities.high) {
26+
message.attachments.push({
27+
title: 'High',
28+
color: '#C0392B',
29+
text: `${summary.vulnerabilities.high}`,
30+
});
31+
}
32+
if (summary.vulnerabilities.moderate) {
33+
message.attachments.push({
34+
title: 'Moderate',
35+
color: '#F5B041',
36+
text: `${summary.vulnerabilities.moderate}`,
37+
});
38+
}
39+
if (summary.vulnerabilities.low) {
40+
message.attachments.push({
41+
title: 'Low',
42+
color: '#F9E79F',
43+
text: `${summary.vulnerabilities.low}`,
44+
});
45+
}
46+
if (summary.vulnerabilities.info) {
47+
message.attachments.push({
48+
title: 'Info',
49+
text: `${summary.vulnerabilities.info}`,
50+
});
51+
}
52+
} else {
53+
message.attachments.push(
54+
{
55+
title: 'No vulnerabilities found',
56+
color: 'good'
57+
}
58+
);
59+
}
60+
61+
return message;
62+
}
63+
64+
async function main() {
65+
const lastAuditLine = await new Promise((resolve, reject) => {
66+
exec(`tail -n 1 ${file}`, (error, stdout, stderr) => {
67+
if (error) {
68+
return reject(error);
69+
}
70+
resolve(stdout);
71+
})
72+
})
73+
74+
const { data: summary } = JSON.parse(`${lastAuditLine}`);
75+
const vulnerabilities = summary?.vulnerabilities || {};
76+
summary.totalVulnerabilities = Object.values(vulnerabilities).reduce((totalVulnerabilities, val) => totalVulnerabilities + val)
77+
fs.writeFileSync(outputFile, JSON.stringify({
78+
channel: process.env.SLACK_AUDIT_REPORT_CHANNEL,
79+
...generateSlackMessage(summary),
80+
}));
81+
}
82+
83+
main();

.circleci/e2e-results.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
const fs = require('fs');
2+
3+
const file = 'tests/e2e/results/e2e.results.json'
4+
const results = {
5+
message: {
6+
text: `*E2ETest - All* (Branch: *${process.env.CIRCLE_BRANCH}*)` +
7+
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
8+
attachments: [],
9+
},
10+
};
11+
12+
const result = JSON.parse(fs.readFileSync(file, 'utf-8'))
13+
const testRunResult = {
14+
color: '#36a64f',
15+
title: `Started at: *${result.startTime}`,
16+
text: `Executed ${result.total} in ${(new Date(result.endTime) - new Date(result.startTime)) / 1000}s`,
17+
fields: [
18+
{
19+
title: 'Passed',
20+
value: result.passed,
21+
short: true,
22+
},
23+
{
24+
title: 'Skipped',
25+
value: result.skipped,
26+
short: true,
27+
},
28+
],
29+
};
30+
const failed = result.total - result.passed;
31+
if (failed) {
32+
results.passed = false;
33+
testRunResult.color = '#cc0000';
34+
testRunResult.fields.push({
35+
title: 'Failed',
36+
value: failed,
37+
short: true,
38+
});
39+
}
40+
41+
results.message.attachments.push(testRunResult);
42+
43+
if (results.passed === false) {
44+
results.message.text = '<!here> ' + results.message.text;
45+
}
46+
47+
fs.writeFileSync('e2e.report.json', JSON.stringify({
48+
channel: process.env.SLACK_TEST_REPORT_CHANNEL,
49+
...results.message,
50+
}));

.circleci/itest-results.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const fs = require('fs');
2+
3+
const file = 'redisinsight/api/test/test-runs/coverage/test-run-result.json'
4+
5+
const results = {
6+
message: {
7+
text: `*ITest - ${process.env.ITEST_NAME}* (Branch: *${process.env.CIRCLE_BRANCH}*)` +
8+
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
9+
attachments: [],
10+
},
11+
};
12+
13+
const result = JSON.parse(fs.readFileSync(file, 'utf-8'))
14+
const testRunResult = {
15+
color: '#36a64f',
16+
title: `Started at: ${result.stats.start}`,
17+
text: `Executed ${result.stats.tests} in ${result.stats.duration / 1000}s`,
18+
fields: [
19+
{
20+
title: 'Passed',
21+
value: result.stats.passes,
22+
short: true,
23+
},
24+
{
25+
title: 'Skipped',
26+
value: result.stats.pending,
27+
short: true,
28+
},
29+
],
30+
};
31+
32+
if (result.stats.failures) {
33+
results.passed = false;
34+
testRunResult.color = '#cc0000';
35+
testRunResult.fields.push({
36+
title: 'Failed',
37+
value: result.stats.failures,
38+
short: true,
39+
});
40+
}
41+
42+
results.message.attachments.push(testRunResult);
43+
44+
if (results.passed === false) {
45+
results.message.text = '<!here> ' + results.message.text;
46+
}
47+
48+
fs.writeFileSync('itests.report.json', JSON.stringify({
49+
channel: process.env.SLACK_TEST_REPORT_CHANNEL,
50+
...results.message,
51+
}));

.circleci/lint-report.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
const fs = require('fs');
2+
3+
const FILENAME = process.env.FILENAME || 'lint.audit.json';
4+
const WORKDIR = process.env.WORKDIR || '.';
5+
const TARGET = process.env.TARGET || '';
6+
const file = `${WORKDIR}/${FILENAME}`;
7+
const outputFile = `${WORKDIR}/slack.${FILENAME}`;
8+
9+
function generateSlackMessage (summary) {
10+
const message = {
11+
text: `CODE SCAN: *${TARGET}* result (Branch: *${process.env.CIRCLE_BRANCH}*)` +
12+
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
13+
attachments: [],
14+
};
15+
16+
if (summary.total) {
17+
if (summary.errors) {
18+
message.attachments.push({
19+
title: 'Errors',
20+
color: '#C0392B',
21+
text: `${summary.errors}`,
22+
});
23+
}
24+
if (summary.warnings) {
25+
message.attachments.push({
26+
title: 'Warnings',
27+
color: '#F5B041',
28+
text: `${summary.warnings}`,
29+
});
30+
}
31+
} else {
32+
message.attachments.push(
33+
{
34+
title: 'No issues found',
35+
color: 'good'
36+
}
37+
);
38+
}
39+
40+
return message;
41+
}
42+
43+
async function main() {
44+
const summary = {
45+
errors: 0,
46+
warnings: 0,
47+
};
48+
const scanResult = JSON.parse(fs.readFileSync(file));
49+
scanResult.forEach(fileResult => {
50+
summary.errors += fileResult.errorCount;
51+
summary.warnings += fileResult.warningCount;
52+
});
53+
54+
summary.total = summary.errors + summary.warnings;
55+
56+
fs.writeFileSync(outputFile, JSON.stringify({
57+
channel: process.env.SLACK_AUDIT_REPORT_CHANNEL,
58+
...generateSlackMessage(summary),
59+
}));
60+
}
61+
62+
main();

.dockerignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.git
2+
.idea
3+
.vscode
4+
.circleci
5+
6+
coverage
7+
dll
8+
node_modules
9+
release
10+
11+
redisinsight/dist
12+
redisinsight/node_modules
13+
redisinsight/main.prod.js
14+
15+
redisinsight/api/.nyc_output
16+
redisinsight/api/coverage
17+
redisinsight/api/dist
18+
redisinsight/api/node_modules
19+
20+
redisinsight/ui/dist

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
quote_type = single
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[/tests/**.ts]
16+
indent_size = 4

.eslintignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Ignores folders covered with custom linters configs
2+
redisinsight/api
3+
tests
4+
5+
# Logs
6+
logs
7+
*.log
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21+
.grunt
22+
23+
# node-waf configuration
24+
.lock-wscript
25+
26+
# Compiled binary addons (http://nodejs.org/api/addons.html)
27+
build/Release
28+
.eslintcache
29+
30+
# Dependency directory
31+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
32+
node_modules
33+
34+
# OSX
35+
.DS_Store
36+
37+
# App packaged
38+
release
39+
*.main.prod.js
40+
*.renderer.prod.js
41+
scripts
42+
configs
43+
dist
44+
dll
45+
*.main.js
46+
47+
.idea
48+
npm-debug.log.*
49+
__snapshots__
50+
51+
# Package.json
52+
package.json
53+
.travis.yml
54+
*.css.d.ts
55+
*.sass.d.ts
56+
*.scss.d.ts

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['airbnb-typescript'],
4+
plugins: ['@typescript-eslint'],
5+
parser: '@typescript-eslint/parser',
6+
rules: {
7+
'max-len': ['warn', 120],
8+
'class-methods-use-this': 'off',
9+
'import/no-extraneous-dependencies': 'off', // temporary disabled
10+
},
11+
parserOptions: {
12+
project: './tsconfig.json',
13+
},
14+
ignorePatterns: [
15+
'redisinsight/ui',
16+
],
17+
};

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
* text eol=lf
2+
*.exe binary
3+
*.png binary
4+
*.jpg binary
5+
*.jpeg binary
6+
*.ico binary
7+
*.icns binary
8+
*.otf binary
9+
*.eot binary
10+
*.ttf binary
11+
*.woff binary
12+
*.woff2 binary

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Add reviewers for the most sensitive folders
2+
3+

0 commit comments

Comments
 (0)