Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
971 changes: 971 additions & 0 deletions .circleci/config.yml

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions .circleci/deps-audit-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
const fs = require('fs');
const { exec } = require("child_process");

const FILENAME = process.env.FILENAME;
const DEPS = process.env.DEPS || '';
const file = `${FILENAME}`;
const outputFile = `slack.${FILENAME}`;

function generateSlackMessage (summary) {
const message = {
text: `DEPS AUDIT: *${DEPS}* result (Branch: *${process.env.CIRCLE_BRANCH}*)` +
`\nScanned ${summary.totalDependencies} dependencies` +
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
attachments: [],
};

if (summary.totalVulnerabilities) {
if (summary.vulnerabilities.critical) {
message.attachments.push({
title: 'Critical',
color: '#641E16',
text: `${summary.vulnerabilities.critical}`,
});
}
if (summary.vulnerabilities.high) {
message.attachments.push({
title: 'High',
color: '#C0392B',
text: `${summary.vulnerabilities.high}`,
});
}
if (summary.vulnerabilities.moderate) {
message.attachments.push({
title: 'Moderate',
color: '#F5B041',
text: `${summary.vulnerabilities.moderate}`,
});
}
if (summary.vulnerabilities.low) {
message.attachments.push({
title: 'Low',
color: '#F9E79F',
text: `${summary.vulnerabilities.low}`,
});
}
if (summary.vulnerabilities.info) {
message.attachments.push({
title: 'Info',
text: `${summary.vulnerabilities.info}`,
});
}
} else {
message.attachments.push(
{
title: 'No vulnerabilities found',
color: 'good'
}
);
}

return message;
}

async function main() {
const lastAuditLine = await new Promise((resolve, reject) => {
exec(`tail -n 1 ${file}`, (error, stdout, stderr) => {
if (error) {
return reject(error);
}
resolve(stdout);
})
})

const { data: summary } = JSON.parse(`${lastAuditLine}`);
const vulnerabilities = summary?.vulnerabilities || {};
summary.totalVulnerabilities = Object.values(vulnerabilities).reduce((totalVulnerabilities, val) => totalVulnerabilities + val)
fs.writeFileSync(outputFile, JSON.stringify({
channel: process.env.SLACK_AUDIT_REPORT_CHANNEL,
...generateSlackMessage(summary),
}));
}

main();
50 changes: 50 additions & 0 deletions .circleci/e2e-results.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const fs = require('fs');

const file = 'tests/e2e/results/e2e.results.json'
const results = {
message: {
text: `*E2ETest - All* (Branch: *${process.env.CIRCLE_BRANCH}*)` +
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
attachments: [],
},
};

const result = JSON.parse(fs.readFileSync(file, 'utf-8'))
const testRunResult = {
color: '#36a64f',
title: `Started at: *${result.startTime}`,
text: `Executed ${result.total} in ${(new Date(result.endTime) - new Date(result.startTime)) / 1000}s`,
fields: [
{
title: 'Passed',
value: result.passed,
short: true,
},
{
title: 'Skipped',
value: result.skipped,
short: true,
},
],
};
const failed = result.total - result.passed;
if (failed) {
results.passed = false;
testRunResult.color = '#cc0000';
testRunResult.fields.push({
title: 'Failed',
value: failed,
short: true,
});
}

results.message.attachments.push(testRunResult);

if (results.passed === false) {
results.message.text = '<!here> ' + results.message.text;
}

fs.writeFileSync('e2e.report.json', JSON.stringify({
channel: process.env.SLACK_TEST_REPORT_CHANNEL,
...results.message,
}));
51 changes: 51 additions & 0 deletions .circleci/itest-results.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const fs = require('fs');

const file = 'redisinsight/api/test/test-runs/coverage/test-run-result.json'

const results = {
message: {
text: `*ITest - ${process.env.ITEST_NAME}* (Branch: *${process.env.CIRCLE_BRANCH}*)` +
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
attachments: [],
},
};

const result = JSON.parse(fs.readFileSync(file, 'utf-8'))
const testRunResult = {
color: '#36a64f',
title: `Started at: ${result.stats.start}`,
text: `Executed ${result.stats.tests} in ${result.stats.duration / 1000}s`,
fields: [
{
title: 'Passed',
value: result.stats.passes,
short: true,
},
{
title: 'Skipped',
value: result.stats.pending,
short: true,
},
],
};

if (result.stats.failures) {
results.passed = false;
testRunResult.color = '#cc0000';
testRunResult.fields.push({
title: 'Failed',
value: result.stats.failures,
short: true,
});
}

results.message.attachments.push(testRunResult);

if (results.passed === false) {
results.message.text = '<!here> ' + results.message.text;
}

fs.writeFileSync('itests.report.json', JSON.stringify({
channel: process.env.SLACK_TEST_REPORT_CHANNEL,
...results.message,
}));
62 changes: 62 additions & 0 deletions .circleci/lint-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const fs = require('fs');

const FILENAME = process.env.FILENAME || 'lint.audit.json';
const WORKDIR = process.env.WORKDIR || '.';
const TARGET = process.env.TARGET || '';
const file = `${WORKDIR}/${FILENAME}`;
const outputFile = `${WORKDIR}/slack.${FILENAME}`;

function generateSlackMessage (summary) {
const message = {
text: `CODE SCAN: *${TARGET}* result (Branch: *${process.env.CIRCLE_BRANCH}*)` +
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
attachments: [],
};

if (summary.total) {
if (summary.errors) {
message.attachments.push({
title: 'Errors',
color: '#C0392B',
text: `${summary.errors}`,
});
}
if (summary.warnings) {
message.attachments.push({
title: 'Warnings',
color: '#F5B041',
text: `${summary.warnings}`,
});
}
} else {
message.attachments.push(
{
title: 'No issues found',
color: 'good'
}
);
}

return message;
}

async function main() {
const summary = {
errors: 0,
warnings: 0,
};
const scanResult = JSON.parse(fs.readFileSync(file));
scanResult.forEach(fileResult => {
summary.errors += fileResult.errorCount;
summary.warnings += fileResult.warningCount;
});

summary.total = summary.errors + summary.warnings;

fs.writeFileSync(outputFile, JSON.stringify({
channel: process.env.SLACK_AUDIT_REPORT_CHANNEL,
...generateSlackMessage(summary),
}));
}

main();
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.git
.idea
.vscode
.circleci

coverage
dll
node_modules
release

redisinsight/dist
redisinsight/node_modules
redisinsight/main.prod.js

redisinsight/api/.nyc_output
redisinsight/api/coverage
redisinsight/api/dist
redisinsight/api/node_modules

redisinsight/ui/dist
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
quote_type = single

[*.md]
trim_trailing_whitespace = false

[/tests/**.ts]
indent_size = 4
56 changes: 56 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Ignores folders covered with custom linters configs
redisinsight/api
tests

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
.eslintcache

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# OSX
.DS_Store

# App packaged
release
*.main.prod.js
*.renderer.prod.js
scripts
configs
dist
dll
*.main.js

.idea
npm-debug.log.*
__snapshots__

# Package.json
package.json
.travis.yml
*.css.d.ts
*.sass.d.ts
*.scss.d.ts
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
extends: ['airbnb-typescript'],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
rules: {
'max-len': ['warn', 120],
'class-methods-use-this': 'off',
'import/no-extraneous-dependencies': 'off', // temporary disabled
},
parserOptions: {
project: './tsconfig.json',
},
ignorePatterns: [
'redisinsight/ui',
],
};
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* text eol=lf
*.exe binary
*.png binary
*.jpg binary
*.jpeg binary
*.ico binary
*.icns binary
*.otf binary
*.eot binary
*.ttf binary
*.woff binary
*.woff2 binary
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add reviewers for the most sensitive folders
/.github/ egor.zalenski@softeq.com artem.horuzhenko@softeq.com
/.circleci/ egor.zalenski@softeq.com artem.horuzhenko@softeq.com
Loading