Skip to content

Commit 5567fee

Browse files
committed
#RI-4462 - add virus check for release
1 parent 9714225 commit 5567fee

File tree

2 files changed

+82
-8
lines changed

2 files changed

+82
-8
lines changed

.circleci/config.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,22 @@ aliases:
9292
echo "analazedHarmless: ${analazedHarmless}, analazedMalicious: ${analazedMalicious}, analazedSuspicious: ${analazedSuspicious}"
9393

9494
if [ "$analazedMalicious" != "0" ] || [ "$analazedSuspicious" != "0" ]; then
95+
echo "export VIRUS_CHECK_FAILED=1" >> $BASH_ENV
9596
echo 'Found dangers'; exit 1;
9697
fi
9798

9899
echo 'Passed';
99100
shell: /bin/bash
100101
no_output_timeout: 15m
102+
virustotalReport: &virustotalReport
103+
run:
104+
name: Virustotal slack report
105+
command: &virusreport |
106+
FILE_NAME=virustotal.report.json
107+
BUILD_NAME=$BUILD_NAME $FILE_NAME=$FILE_NAME VIRUS_CHECK_FAILED=$VIRUS_CHECK_FAILED node .circleci/virustotal-report.js
108+
# BUILD_NAME=$BUILD_NAME $FILE_NAME=$FILE_NAME VIRUS_CHECK_FAILED=$VIRUS_CHECK_FAILED node .circleci/virustotal-report.js &&
109+
# curl -H "Content-type: application/json" --data @$FILE_NAME -H "Authorization: Bearer ${SLACK_TEST_REPORT_KEY}" -X POST https://slack.com/api/chat.postMessage
110+
shell: /bin/bash
101111
iTestsNames: &iTestsNames
102112
- oss-st-5 # OSS Standalone v5
103113
- oss-st-5-pass # OSS Standalone v5 with admin pass required
@@ -718,8 +728,20 @@ jobs:
718728
name: export URL environment variable
719729
command: |
720730
echo 'export URL="https://download.redisinsight.redis.com/latest/<< parameters.fileName >>"' >> $BASH_ENV
731+
echo 'export BUILD_NAME="<< parameters.fileName >>"' >> $BASH_ENV
721732
- <<: *urlScan
722733
- <<: *validate
734+
- <<: *virustotalReport
735+
736+
virustotal-report:
737+
executor: linux-executor
738+
steps:
739+
- checkout
740+
- run:
741+
name: Send virustotal passed report
742+
command: |
743+
echo 'export VIRUS_CHECK_FAILED=0' >> $BASH_ENV
744+
- <<: *virustotalReport
723745
docker:
724746
executor: linux-executor
725747
parameters:
@@ -1073,45 +1095,56 @@ workflows:
10731095
# requires: *devBuildRequire
10741096

10751097
- virustotal-url:
1076-
name: Virus check - AppImage (prod)
1098+
name: Virus check - AppImage (nightly)
10771099
fileName: RedisInsight-v2-linux-x86_64.AppImage
10781100
# requires:
10791101
# - Build app - Linux (dev)
10801102
- virustotal-url:
1081-
name: Virus check - deb (prod)
1103+
name: Virus check - deb (nightly)
10821104
fileName: RedisInsight-v2-linux-amd64.deb
10831105
# requires:
10841106
# - Build app - Linux (dev)
10851107
- virustotal-url:
1086-
name: Virus check - rpm (prod)
1108+
name: Virus check - rpm (nightly)
10871109
fileName: RedisInsight-v2-linux-x86_64.rpm
10881110
# requires:
10891111
# - Build app - Linux (dev)
10901112
- virustotal-url:
1091-
name: Virus check - snap (prod)
1113+
name: Virus check - snap (nightly)
10921114
fileName: RedisInsight-v2-linux-amd64.snap
10931115
# requires:
10941116
# - Build app - Linux (dev)
10951117
- virustotal-url:
1096-
name: Virus check x64 - dmg (prod)
1118+
name: Virus check x64 - dmg (nightly)
10971119
fileName: RedisInsight-v2-mac-x64.dmg
10981120
# requires:
10991121
# - Build app - MacOS (dev)
11001122
- virustotal-url:
1101-
name: Virus check arm64 - dmg (prod)
1123+
name: Virus check arm64 - dmg (nightly)
11021124
fileName: RedisInsight-v2-mac-arm64.dmg
11031125
# requires:
11041126
# - Build app - MacOS (dev)
11051127
- virustotal-url:
1106-
name: Virus check MAS - pkg (prod)
1128+
name: Virus check MAS - pkg (nightly)
11071129
fileName: RedisInsight-mac-universal-mas.pkg
11081130
# requires:
11091131
# - Build app - MacOS (dev)
11101132
- virustotal-url:
1111-
name: Virus check - exe (prod)
1133+
name: Virus check - exe (nightly)
11121134
fileName: RedisInsight-v2-win-installer.exe
11131135
# requires:
11141136
# - Build app - Windows (dev)
1137+
- virustotal-report:
1138+
name: Virus report (prod)
1139+
requires:
1140+
- Virus check - AppImage (nightly)
1141+
- Virus check - deb (nightly)
1142+
- Virus check - rpm (nightly)
1143+
- Virus check - snap (nightly)
1144+
- Virus check x64 - dmg (nightly)
1145+
- Virus check arm64 - dmg (nightly)
1146+
- Virus check MAS - pkg (nightly)
1147+
- Virus check - exe (nightly)
11151148
# - store-build-artifacts:
11161149
# name: Store build artifacts (dev)
11171150
# requires:

.circleci/virustotal-report.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const fs = require('fs');
2+
3+
const fileName = process.env.FILE_NAME;
4+
const buildName = process.env.BUILD_NAME;
5+
const failed = !!parseInt(process.env.VIRUS_CHECK_FAILED, 10);
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.fields.push({
26+
title: 'Failed build',
27+
value: buildName,
28+
short: true,
29+
});
30+
}
31+
32+
results.message.attachments.push(result);
33+
34+
if (failed === true) {
35+
results.message.text = '<!here> ' + results.message.text;
36+
}
37+
38+
fs.writeFileSync(fileName, JSON.stringify({
39+
channel: process.env.SLACK_VIRUSTOTAL_REPORT_CHANNEL,
40+
...results.message,
41+
}));

0 commit comments

Comments
 (0)