Skip to content

Commit 7fbd572

Browse files
committed
[CI] issue: 4705805 Add antivirus scan to release job
Add antivirus scan step to the release job to scan release packages. Signed-off-by: Noam Tsemah <[email protected]>
1 parent 0dc96e0 commit 7fbd572

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

.ci/antivirus.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash -Exel
2+
3+
echo -e "\n\n**********************************"
4+
echo -e "\n\nStarting antivirus.sh script...\n\n"
5+
echo -e "**********************************\n\n"
6+
7+
[[ -z "$WORKSPACE" ]] && { echo "ERROR: WORKSPACE variable is empty"; exit 1; }
8+
[[ ! -d "$WORKSPACE" ]] && { echo "ERROR: ${WORKSPACE} does not exist"; exit 1; }
9+
[[ -z "$release_folder" ]] && { echo "ERROR: release_folder variable is empty"; exit 1; }
10+
[[ -z "$revision" ]] && { echo "ERROR: revision variable is empty"; exit 1; }
11+
[[ ! -d "$release_folder" ]] && { echo "ERROR: ${release_folder} does not exist"; exit 1; }
12+
[[ -z "$release_tag" ]] && { echo "ERROR: release_tag variable is empty"; exit 1; }
13+
14+
release_src_folder="${release_folder}/vma_v_${release_tag}-0/src"
15+
[[ -d "$release_src_folder" ]] && { echo "EERROR: ${release_src_folder} does not exist"; exit 1; }
16+
17+
mkdir -p "${WORKSPACE}/logs/"
18+
19+
cd "${release_src_folder}/"
20+
pkg_name="libvma-${release_tag}-${revision}.src.rpm"
21+
tarball_name="libvma-${release_tag}.tar.gz"
22+
23+
RPM_LOG="${WORKSPACE}/logs/${pkg_name}_antivirus.log"
24+
TARBALL_LOG="${WORKSPACE}/logs/${tarball_name}_antivirus.log"
25+
26+
sudo -E -u swx-jenkins /auto/GLIT/SCRIPTS/HELPERS/antivirus-scan.sh "${release_src_folder}/${pkg_name}" 2>&1 | tee "$RPM_LOG"
27+
sudo -E -u swx-jenkins /auto/GLIT/SCRIPTS/HELPERS/antivirus-scan.sh "${release_src_folder}/${tarball_name}" 2>&1 | tee "$TARBALL_LOG"
28+
29+
if grep -q 'Possibly Infected:............. 0' "$RPM_LOG" && grep -q 'Possibly Infected:............. 0' "$TARBALL_LOG"; then
30+
exit 0
31+
else
32+
exit 1
33+
fi

.ci/pipeline/release_jjb.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
- bool:
3535
name: "do_release"
3636
default: true
37-
description: "Release build packges into the release folder, set to false for debugging"
37+
description: "Release build packages into the release folder, set to false for debugging"
38+
- bool:
39+
name: "do_antivirus"
40+
default: true
41+
description: "Run Antivirus scan."
3842
- string:
3943
name: "notification_email"
4044
default: "{jjb_release_email}"

.ci/pipeline/release_matrix_job.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ volumes:
2424
- {mountPath: /auto/mswg/release/vma, hostPath: /auto/mswg/release/vma}
2525
# User profile for release
2626
- {mountPath: /var/home/swx-jenkins, hostPath: /labhome/swx-jenkins}
27+
# for Antivirus
28+
- {mountPath: /auto/GLIT/SCRIPTS/HELPERS, hostPath: /auto/GLIT/SCRIPTS/HELPERS}
2729

2830
empty_volumes:
2931
- {mountPath: /tmp/source_rpms, memory: true}
@@ -45,6 +47,12 @@ steps:
4547
.ci/do_release.sh
4648
archiveArtifacts: pkg/build_pkg.log,pkg/packages/*.rpm
4749

50+
- name: Antivirus
51+
enable: ${do_antivirus}
52+
run: |
53+
env WORKSPACE=$PWD .ci/antivirus.sh
54+
archiveArtifacts: 'logs/'
55+
4856
pipeline_start:
4957
shell: action
5058
module: groovy

0 commit comments

Comments
 (0)