Skip to content

Commit cda0209

Browse files
author
Artem
committed
Merge branch 'feature/RI-4075_livetime_recommendations' into feature/RI-4399-beta_features
# Conflicts: # redisinsight/api/src/constants/telemetry-events.ts
2 parents 390073b + f4820e6 commit cda0209

File tree

211 files changed

+4881
-2015
lines changed

Some content is hidden

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

211 files changed

+4881
-2015
lines changed

.circleci/config.yml

Lines changed: 140 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,29 @@ aliases:
2828
$filePathWithQuotes = '"{0}"' -f $filePath
2929
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtool.exe" sign /a /sm /n "Redis Labs Inc." /fd sha256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /v $FilePathWithQuotes
3030
shell: powershell.exe
31-
scan: &scan
31+
fileScan: &fileScan
3232
run:
33-
name: Virustotal scan
34-
command: &virusscan |
33+
name: Virustotal file scan
34+
command: &virusfilescan |
3535
uploadUrl=$(curl -sq -XGET https://www.virustotal.com/api/v3/files/upload_url -H "x-apikey: $VIRUSTOTAL_API_KEY" | jq -r '.data')
3636
uploadFile=$("/usr/bin/find" /tmp/release -name ${FILE_NAME})
3737
echo "File to upload: ${uploadFile}"
3838
analysedId=$(curl -sq -XPOST "${uploadUrl}" -H "x-apikey: $VIRUSTOTAL_API_KEY" --form file=@"${uploadFile}" | jq -r '.data.id')
39+
if [ $analysedId == "null" ]; then
40+
echo 'Status is null, something went wrong'; exit 1;
41+
fi
42+
echo "export ANALYZED_ID=${analysedId}" >> $BASH_ENV
43+
echo "Virustotal Analyzed id: ${analysedId}"
44+
sleep 10
45+
shell: /bin/bash
46+
urlScan: &urlScan
47+
run:
48+
name: Virustotal url scan
49+
command: &virusurlscan |
50+
echo "Url to check: ${URL}"
51+
52+
analysedId=$(curl -sq -XPOST https://www.virustotal.com/api/v3/urls -H "x-apikey: $VIRUSTOTAL_API_KEY" --form url=${URL} | jq -r '.data.id')
53+
3954
if [ $analysedId == "null" ]; then
4055
echo 'Status is null, something went wrong'; exit 1;
4156
fi
@@ -76,13 +91,32 @@ aliases:
7691
echo "Results:"
7792
echo "analazedHarmless: ${analazedHarmless}, analazedMalicious: ${analazedMalicious}, analazedSuspicious: ${analazedSuspicious}"
7893

79-
if [ "$analazedHarmless" != "0" ] || [ "$analazedMalicious" != "0" ] || [ "$analazedSuspicious" != "0" ]; then
80-
echo 'Found dangers'; exit 1;
94+
if [ "$analazedMalicious" != "0" ] || [ "$analazedSuspicious" != "0" ]; then
95+
echo "export VIRUS_CHECK_FAILED=true" >> $BASH_ENV
96+
echo 'Found dangers'; exit 0;
8197
fi
8298

99+
echo "export VIRUS_CHECK_FAILED=false" >> $BASH_ENV
100+
echo "export SKIP_VIRUSTOTAL_REPORT=true" >> $BASH_ENV
83101
echo 'Passed';
84102
shell: /bin/bash
85103
no_output_timeout: 15m
104+
virustotalReport: &virustotalReport
105+
run:
106+
name: Virustotal slack report
107+
command: &virusreport |
108+
if [ "$SKIP_VIRUSTOTAL_REPORT" == "true" ]; then
109+
exit 0;
110+
fi
111+
112+
FILE_NAME=virustotal.report.json
113+
BUILD_NAME=$BUILD_NAME FILE_NAME=$FILE_NAME VIRUS_CHECK_FAILED=$VIRUS_CHECK_FAILED node .circleci/virustotal-report.js &&
114+
curl -H "Content-type: application/json" --data @$FILE_NAME -H "Authorization: Bearer ${SLACK_TEST_REPORT_KEY}" -X POST https://slack.com/api/chat.postMessage
115+
116+
if [ "$VIRUS_CHECK_FAILED" == "true" ]; then
117+
echo 'Found dangers'; exit 1;
118+
fi
119+
shell: /bin/bash
86120
iTestsNames: &iTestsNames
87121
- oss-st-5 # OSS Standalone v5
88122
- oss-st-5-pass # OSS Standalone v5 with admin pass required
@@ -612,6 +646,7 @@ jobs:
612646
613647
UPGRADES_LINK='' SEGMENT_WRITE_KEY='' yarn package:stage && yarn package:mas
614648
rm -rf release/mac
649+
mv release/mas-universal/RedisInsight-mac-universal-mas.pkg release/RedisInsight-mac-universal-mas.pkg
615650
no_output_timeout: 60m
616651

617652
- run:
@@ -625,7 +660,7 @@ jobs:
625660
- release/RedisInsight*.zip
626661
- release/RedisInsight*.dmg
627662
- release/RedisInsight*.dmg.blockmap
628-
- release/**/*.pkg
663+
- release/RedisInsight*.pkg
629664
- release/*-mac.yml
630665
- release/redisstack
631666
windows:
@@ -674,7 +709,7 @@ jobs:
674709
- release/RedisInsight*.exe
675710
- release/RedisInsight*.exe.blockmap
676711
- release/*.yml
677-
virustotal:
712+
virustotal-file:
678713
executor: linux-executor
679714
parameters:
680715
ext:
@@ -688,8 +723,35 @@ jobs:
688723
name: export FILE_NAME environment variable
689724
command: |
690725
echo 'export FILE_NAME="RedisInsight*<< parameters.ext >>"' >> $BASH_ENV
691-
- <<: *scan
726+
- <<: *fileScan
692727
- <<: *validate
728+
virustotal-url:
729+
executor: linux-executor
730+
parameters:
731+
fileName:
732+
description: File name
733+
type: string
734+
steps:
735+
- checkout
736+
- run:
737+
name: export URL environment variable
738+
command: |
739+
echo 'export URL="https://download.redisinsight.redis.com/latest/<< parameters.fileName >>"' >> $BASH_ENV
740+
echo 'export BUILD_NAME="<< parameters.fileName >>"' >> $BASH_ENV
741+
- <<: *urlScan
742+
- <<: *validate
743+
- <<: *virustotalReport
744+
745+
virustotal-report:
746+
executor: linux-executor
747+
steps:
748+
- checkout
749+
- run:
750+
name: Send virustotal passed report
751+
command: |
752+
echo 'export VIRUS_CHECK_FAILED=0' >> $BASH_ENV
753+
echo 'export SKIP_VIRUSTOTAL_REPORT=false' >> $BASH_ENV
754+
- <<: *virustotalReport
693755
docker:
694756
executor: linux-executor
695757
parameters:
@@ -1159,27 +1221,42 @@ workflows:
11591221
env: prod
11601222
requires: *prodElectronBuildRequires
11611223
# virus check all electron apps (prod)
1162-
- virustotal:
1224+
- virustotal-file:
11631225
name: Virus check - AppImage (prod)
11641226
ext: .AppImage
11651227
requires:
11661228
- Build app - Linux (prod)
1167-
- virustotal:
1229+
- virustotal-file:
11681230
name: Virus check - deb (prod)
11691231
ext: .deb
11701232
requires:
11711233
- Build app - Linux (prod)
1172-
- virustotal:
1234+
- virustotal-file:
1235+
name: Virus check - rpm (prod)
1236+
ext: .rpm
1237+
requires:
1238+
- Build app - Linux (prod)
1239+
- virustotal-file:
1240+
name: Virus check - snap (prod)
1241+
ext: .snap
1242+
requires:
1243+
- Build app - Linux (prod)
1244+
- virustotal-file:
11731245
name: Virus check x64 - dmg (prod)
11741246
ext: -x64.dmg
11751247
requires:
11761248
- Build app - MacOS (prod)
1177-
- virustotal:
1249+
- virustotal-file:
11781250
name: Virus check arm64 - dmg (prod)
11791251
ext: -arm64.dmg
11801252
requires:
11811253
- Build app - MacOS (prod)
1182-
- virustotal:
1254+
- virustotal-file:
1255+
name: Virus check MAS - pkg (prod)
1256+
ext: -mas.pkg
1257+
requires:
1258+
- Build app - MacOS (prod)
1259+
- virustotal-file:
11831260
name: Virus check - exe (prod)
11841261
ext: .exe
11851262
requires:
@@ -1190,8 +1267,11 @@ workflows:
11901267
requires:
11911268
- Virus check - AppImage (prod)
11921269
- Virus check - deb (prod)
1270+
- Virus check - rpm (prod)
1271+
- Virus check - snap (prod)
11931272
- Virus check x64 - dmg (prod)
11941273
- Virus check arm64 - dmg (prod)
1274+
- Virus check MAS - pkg (prod)
11951275
- Virus check - exe (prod)
11961276
# Manual approve for publish release
11971277
- approve-publish:
@@ -1230,10 +1310,10 @@ workflows:
12301310
name: Build app - Linux (stage)
12311311
requires:
12321312
- Setup build (stage)
1233-
# - windows:
1234-
# name: Build app - Windows (stage)
1235-
# requires:
1236-
# - Setup build (stage)
1313+
# - windows:
1314+
# name: Build app - Windows (stage)
1315+
# requires:
1316+
# - Setup build (stage)
12371317
# integration tests on docker image build
12381318
- integration-tests-run:
12391319
matrix:
@@ -1254,12 +1334,49 @@ workflows:
12541334
requires:
12551335
- Build docker image
12561336
# e2e desktop tests on AppImage build
1257-
# - e2e-app-image:
1258-
# name: E2ETest (AppImage) - Nightly
1259-
# parallelism: 4
1260-
# report: true
1261-
# requires:
1262-
# - Build app - Linux (stage)
1337+
- e2e-app-image:
1338+
name: E2ETest (AppImage) - Nightly
1339+
parallelism: 2
1340+
report: true
1341+
requires:
1342+
- Build app - Linux (stage)
1343+
1344+
- virustotal-url:
1345+
name: Virus check - AppImage (nightly)
1346+
fileName: RedisInsight-v2-linux-x86_64.AppImage
1347+
- virustotal-url:
1348+
name: Virus check - deb (nightly)
1349+
fileName: RedisInsight-v2-linux-amd64.deb
1350+
- virustotal-url:
1351+
name: Virus check - rpm (nightly)
1352+
fileName: RedisInsight-v2-linux-x86_64.rpm
1353+
- virustotal-url:
1354+
name: Virus check - snap (nightly)
1355+
fileName: RedisInsight-v2-linux-amd64.snap
1356+
- virustotal-url:
1357+
name: Virus check x64 - dmg (nightly)
1358+
fileName: RedisInsight-v2-mac-x64.dmg
1359+
- virustotal-url:
1360+
name: Virus check arm64 - dmg (nightly)
1361+
fileName: RedisInsight-v2-mac-arm64.dmg
1362+
- virustotal-url:
1363+
name: Virus check MAS - pkg (nightly)
1364+
fileName: RedisInsight-mac-universal-mas.pkg
1365+
- virustotal-url:
1366+
name: Virus check - exe (nightly)
1367+
fileName: RedisInsight-v2-win-installer.exe
1368+
- virustotal-report:
1369+
name: Virus check report (prod)
1370+
requires:
1371+
- Virus check - AppImage (nightly)
1372+
- Virus check - deb (nightly)
1373+
- Virus check - rpm (nightly)
1374+
- Virus check - snap (nightly)
1375+
- Virus check x64 - dmg (nightly)
1376+
- Virus check arm64 - dmg (nightly)
1377+
- Virus check MAS - pkg (nightly)
1378+
- Virus check - exe (nightly)
1379+
12631380
# # e2e desktop tests on exe build
12641381
# - e2e-exe:
12651382
# name: E2ETest (exe) - Nightly

.circleci/virustotal-report.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const fs = require('fs');
2+
3+
const fileName = process.env.FILE_NAME;
4+
const buildName = process.env.BUILD_NAME;
5+
const failed = process.env.VIRUS_CHECK_FAILED === 'true';
6+
7+
const results = {
8+
message: {
9+
text: `*Virustotal checks* (Branch: *${process.env.CIRCLE_BRANCH}*)` +
10+
`\n<https://app.circleci.com/pipelines/workflows/${process.env.CIRCLE_WORKFLOW_ID}|View on CircleCI>`,
11+
attachments: [],
12+
},
13+
};
14+
15+
const result = {
16+
color: '#36a64f',
17+
title: `Finished at: ${new Date().toISOString()}`,
18+
text: `All builds were passed via virustotal checks`,
19+
fields: [],
20+
};
21+
22+
if (failed) {
23+
results.passed = false;
24+
result.color = '#cc0000';
25+
result.text = 'Build had failed virustotal checks';
26+
result.fields.push({
27+
title: 'Failed build',
28+
value: buildName,
29+
short: true,
30+
});
31+
}
32+
33+
results.message.attachments.push(result);
34+
35+
if (failed === true) {
36+
results.message.text = '<!here> ' + results.message.text;
37+
}
38+
39+
fs.writeFileSync(fileName, JSON.stringify({
40+
channel: process.env.SLACK_VIRUSTOTAL_REPORT_CHANNEL,
41+
...results.message,
42+
}));

redisinsight/api/config/default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default {
5151
contentUri: '/static/content',
5252
defaultPluginsUri: '/static/plugins',
5353
pluginsAssetsUri: '/static/resources/plugins',
54+
base: process.env.RI_BASE || '/',
5455
secretStoragePassword: process.env.SECRET_STORAGE_PASSWORD,
5556
tls: process.env.SERVER_TLS ? process.env.SERVER_TLS === 'true' : true,
5657
tlsCert: process.env.SERVER_TLS_CERT,

redisinsight/api/src/__mocks__/analytics.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
import { EventEmitter2 } from '@nestjs/event-emitter';
2+
import { BulkActionsAnalyticsService } from 'src/modules/bulk-actions/bulk-actions-analytics.service';
3+
4+
const mockEmitter = new EventEmitter2();
5+
6+
class AnalyticsService extends BulkActionsAnalyticsService {
7+
constructor(protected eventEmitter: EventEmitter2) {
8+
super(eventEmitter);
9+
}
10+
}
11+
112
export const mockInstancesAnalyticsService = () => ({
213
sendInstanceListReceivedEvent: jest.fn(),
314
sendInstanceAddedEvent: jest.fn(),
@@ -29,6 +40,8 @@ export const mockSettingsAnalyticsService = () => ({
2940
sendSettingsUpdatedEvent: jest.fn(),
3041
});
3142

43+
export const mockBulActionsAnalyticsService = new AnalyticsService(mockEmitter);
44+
3245
export const mockPubSubAnalyticsService = () => ({
3346
sendMessagePublishedEvent: jest.fn(),
3447
sendChannelSubscribeEvent: jest.fn(),

redisinsight/api/src/common/constants/recommendations.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ export enum SearchVisualizationCommands {
88
TS_MRANGE = "TS.MRANGE",
99
}
1010

11-
export enum GraphVisualizationCommands {
12-
GRAPH_QUERY = "GRAPH.QUERY",
13-
GRAPH_RO_QUERY = "GRAPH.RO_QUERY",
14-
GRAPH_EXPLAIN = "GRAPH.EXPLAIN",
15-
GRAPH_PROFILE = "GRAPH.PROFILE",
16-
}
11+
export const LUA_SCRIPT_RECOMMENDATION_COUNT = 10;
12+
export const BIG_HASHES_RECOMMENDATION_LENGTH = 5000;
13+
export const COMBINE_SMALL_STRINGS_TO_HASHES_RECOMMENDATION_MEMORY = 200;
14+
export const USE_SMALLER_KEYS_RECOMMENDATION_TOTAL = 1_000_000;
15+
export const COMPRESS_HASH_FIELD_NAMES_RECOMMENDATION_LENGTH = 1000;
16+
export const COMPRESSION_FOR_LIST_RECOMMENDATION_LENGTH = 1000;
17+
export const BIG_SETS_RECOMMENDATION_LENGTH = 100_000;
18+
export const BIG_AMOUNT_OF_CONNECTED_CLIENTS_RECOMMENDATION_CLIENTS = 100;
19+
export const BIG_STRINGS_RECOMMENDATION_MEMORY = 1_000_000;
20+
export const RTS_RECOMMENDATION_PERCENTAGE = 99;
21+
export const SEARCH_INDEXES_RECOMMENDATION_KEYS_FOR_CHECK = 100;
22+
export const REDIS_VERSION_RECOMMENDATION_VERSION = '6';
23+
export const COMBINE_SMALL_STRINGS_TO_HASHES_RECOMMENDATION_KEYS_COUNT = 50;
24+
export const INTEGERS_IN_SET_RECOMMENDATION_MEMBERS_FOR_CHECK = 50;
25+
export const SEARCH_HASH_RECOMMENDATION_KEYS_FOR_CHECK = 50;
26+
export const SEARCH_HASH_RECOMMENDATION_KEYS_LENGTH = 2;

redisinsight/api/src/constants/recommendations.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ export const RECOMMENDATION_NAMES = Object.freeze({
1515
SET_PASSWORD: 'setPassword',
1616
RTS: 'RTS',
1717
REDIS_VERSION: 'redisVersion',
18-
SEARCH_STRING: 'searchString',
1918
SEARCH_INDEXES: 'searchIndexes',
2019
SEARCH_JSON: 'searchJSON',
2120
INTEGERS_IN_SET: 'integersInSets',
2221
STRING_TO_JSON: 'stringToJson',
2322
SEARCH_VISUALIZATION: 'searchVisualization',
24-
GRAPH_VISUALIZATION: 'graphVisualization',
23+
SEARCH_HASH: 'searchHash',
2524
});
2625

2726
export const ONE_NODE_RECOMMENDATIONS = [
@@ -38,7 +37,6 @@ export const REDIS_STACK = [
3837
RECOMMENDATION_NAMES.RTS,
3938
RECOMMENDATION_NAMES.REDIS_VERSION,
4039
RECOMMENDATION_NAMES.SEARCH_INDEXES,
41-
RECOMMENDATION_NAMES.SEARCH_STRING,
4240
RECOMMENDATION_NAMES.SEARCH_JSON,
4341
RECOMMENDATION_NAMES.INTEGERS_IN_SET,
4442
RECOMMENDATION_NAMES.STRING_TO_JSON,

redisinsight/api/src/constants/telemetry-events.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export enum TelemetryEvents {
6464
// Bulk Actions
6565
BulkActionsStarted = 'BULK_ACTIONS_STARTED',
6666
BulkActionsStopped = 'BULK_ACTIONS_STOPPED',
67+
BulkActionsSucceed = 'BULK_ACTIONS_SUCCEED',
68+
BulkActionsFailed = 'BULK_ACTIONS_FAILED',
6769

6870
// Feature
6971
FeatureFlagConfigUpdated = 'FEATURE_FLAG_CONFIG_UPDATED',

0 commit comments

Comments
 (0)