Skip to content

Commit 01a8340

Browse files
committed
[CI] Issue: HPCINFRA-3441 move antivirus scan to release job
Move the antivirus scan step from the regular matrix file to the release matrix file Signed-off-by: Noam Tsemah <[email protected]>
1 parent b6c644a commit 01a8340

File tree

5 files changed

+33
-51
lines changed

5 files changed

+33
-51
lines changed

.ci/antivirus.sh

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,32 @@ echo -e "\n\n**********************************"
44
echo -e "\n\nStarting antivirus.sh script...\n\n"
55
echo -e "**********************************\n\n"
66

7-
if [ -z "$1" ]; then
8-
if [ -z "${release_folder}" ]; then
9-
echo "ERROR: Please use the first script argument or env var 'release_folder'. Exit"
10-
fi
11-
else
12-
release_folder=$1
13-
fi
14-
if [ ! -e "${release_folder}" ] || [ ! -d "${release_folder}" ]; then
15-
echo "ERROR: [${release_folder}] directory doesn't exist. Exit"
16-
exit 1
17-
fi
18-
19-
if [ -z "$2" ]; then
20-
if [ -z "${release_version}" ]; then
21-
echo "ERROR: Please use the second script argument or env var 'release_version'. Exit"
22-
fi
23-
else
24-
release_version=$2
25-
echo "FULL_VERSION from script parameter: [${release_version}]"
26-
fi
27-
if [ -z "${release_version}" ]; then
28-
release_version=$(git describe --tags $(git rev-list --tags --max-count=1))
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+
[[ ! -d "$release_folder" ]] && { echo "ERROR: ${release_folder} does not exist"; exit 1; }
11+
[[ -z "$release_tag" ]] && { echo "ERROR: release_tag variable is empty"; exit 1; }
12+
13+
if [ -z "${revision}" ]; then
14+
echo "WARN: 'revision' was not set, defaulting to 1"
15+
revision=1
2916
fi
3017

31-
mkdir -p logs
18+
cd "${release_folder}/${release_tag}/"
19+
pkg_name=$(ls -1 libxlio-"${release_tag}"-"${revision}".src.rpm)
3220

33-
cd ${release_folder}/${release_version}/
34-
pkg_name=$(ls -1 libxlio-*.src.rpm)
21+
if ! [[ -e "$pkg_name" ]]; then
22+
echo "ERROR: ${release_folder}/${release_tag}/${pkg_name} does not exist. Exit"
23+
exit 1
24+
fi
3525

36-
export PROJECT_SRC_PATH=${release_folder}/${release_version}/$pkg_name
37-
LOG=$WORKSPACE/logs/${name}_antivirus.log
26+
mkdir -p "${WORKSPACE}/logs/"
27+
LOG="${WORKSPACE}/logs/${pkg_name}_antivirus.log"
3828

39-
sudo -E -u swx-jenkins /auto/GLIT/SCRIPTS/HELPERS/antivirus-scan.sh $PROJECT_SRC_PATH 2>&1 | tee $LOG
29+
sudo -E -u swx-jenkins /auto/GLIT/SCRIPTS/HELPERS/antivirus-scan.sh "${release_folder}/${release_tag}/${pkg_name}" 2>&1 | tee "$LOG"
4030

41-
cat $LOG | grep 'Possibly Infected:............. 0'
42-
if [ $? -ne 0 ];then
43-
status=1
31+
if grep -q 'Possibly Infected:............. 0' "$LOG"; then
32+
exit 0
4433
else
45-
status=0
34+
exit 1
4635
fi
47-
exit $status

.ci/matrix_job.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ volumes:
2626
- {mountPath: /auto/sw_tools/Commercial, hostPath: /auto/sw_tools/Commercial}
2727
- {mountPath: /hpc/local/commercial, hostPath: /hpc/local/commercial}
2828
- {mountPath: /hpc/local/etc/modulefiles, hostPath: /hpc/local/etc/modulefiles}
29-
# for Antivirus
30-
- {mountPath: /auto/BACKUP/logs_of_LOGS, hostPath: /auto/BACKUP/logs_of_LOGS}
31-
- {mountPath: /auto/GLIT/SCRIPTS/HELPERS, hostPath: /auto/GLIT/SCRIPTS/HELPERS}
3229
# Default release location
3330
- {mountPath: /auto/sw/release/sw_acceleration, hostPath: /auto/sw/release/sw_acceleration}
3431
# User profile for release
@@ -209,16 +206,6 @@ steps:
209206
archiveArtifacts-onfail: |
210207
jenkins/**/arch-*.tar.gz
211208
212-
- name: Antivirus
213-
enable: ${do_antivirus}
214-
containerSelector:
215-
- "{name: 'rhel8.3-mofed-x86_64', category: 'base', variant: 1}"
216-
agentSelector:
217-
- "{nodeLabel: 'skip-agent'}"
218-
run: |
219-
env WORKSPACE=$PWD .ci/antivirus.sh ${release_folder}
220-
archiveArtifacts: 'logs/'
221-
222209
- name: Style
223210
enable: ${do_style}
224211
containerSelector:

.ci/opensource_jjb.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
name: "do_package"
5454
default: true
5555
description: "Check tar, source and binary packages."
56-
- bool:
57-
name: "do_antivirus"
58-
default: false
59-
description: "Run Antivirus."
6056
- bool:
6157
name: "do_cppcheck"
6258
default: true

.ci/pipeline/release_jjb.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
name: "do_release"
3636
default: true
3737
description: "Release build packges into the release folder, set to false for debugging"
38+
- bool:
39+
name: "do_antivirus"
40+
default: true
41+
description: "Run Antivirus."
3842
- string:
3943
name: "notification_email"
4044
default: "{jjb_release_email}"

.ci/pipeline/release_matrix_job.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ volumes:
2121
- {mountPath: /auto/sw/release/sw_acceleration, hostPath: /auto/sw/release/sw_acceleration}
2222
# User profile for release
2323
- {mountPath: /var/home/swx-jenkins, hostPath: /labhome/swx-jenkins}
24+
# for Antivirus
25+
- {mountPath: /auto/GLIT/SCRIPTS/HELPERS, hostPath: /auto/GLIT/SCRIPTS/HELPERS}
2426

2527
runs_on_dockers:
2628
- {
@@ -32,7 +34,6 @@ runs_on_dockers:
3234
tag: '20250304'
3335
}
3436

35-
3637
steps:
3738
- name: Build-dpcp
3839
parallel: false
@@ -47,6 +48,12 @@ steps:
4748
.ci/do_release.sh
4849
archiveArtifacts: "**/build_pkg.log,**/packages/*.rpm"
4950

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

0 commit comments

Comments
 (0)