Skip to content

Commit 58b7e41

Browse files
committed
Fixed exit_code issue in pipeline.rs
1 parent 6209c85 commit 58b7e41

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
context: .
2929
file: ./Dockerfile
3030
push: true
31-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v5
31+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v6

src/utils/common.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ pub async fn insert_job_info(
197197
.into_iter()
198198
.map(|v| to_bson(&v).unwrap_or(Bson::Null))
199199
.collect();
200-
201200
// Create the document to insert
202201
let document = doc! {
203202
"job_id": job_id,

src/utils/pipeline.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,10 @@ pub async fn pipeline_failure(
951951
}
952952
}
953953
}
954-
exit_code = common::EXIT_CODE_SAST_FAILED;
955-
exit_msg = common::SAST_FAILED_MSG.to_string();
954+
if is_pipeline_failed {
955+
exit_code = common::EXIT_CODE_SAST_FAILED;
956+
exit_msg = common::SAST_FAILED_MSG.to_string();
957+
}
956958
}
957959

958960
if is_sca && sca_policy.is_some() {
@@ -999,8 +1001,10 @@ pub async fn pipeline_failure(
9991001
}
10001002
}
10011003
}
1002-
exit_code = common::EXIT_CODE_SCA_FAILED;
1003-
exit_msg = common::SCA_FAILED_MSG.to_string();
1004+
if is_pipeline_failed {
1005+
exit_code = common::EXIT_CODE_SCA_FAILED;
1006+
exit_msg = common::SCA_FAILED_MSG.to_string();
1007+
}
10041008
}
10051009

10061010
if is_secret && secret_policy.is_some() {
@@ -1056,9 +1060,10 @@ pub async fn pipeline_failure(
10561060
}
10571061
}
10581062
}
1059-
1060-
exit_code = common::EXIT_CODE_SECRET_FAILED;
1061-
exit_msg = common::SECRET_FAILED_MSG.to_string();
1063+
if is_pipeline_failed {
1064+
exit_code = common::EXIT_CODE_SECRET_FAILED;
1065+
exit_msg = common::SECRET_FAILED_MSG.to_string();
1066+
}
10621067
}
10631068
if is_license_compliance && license_policy.is_some() {
10641069
let license_policy = license_policy.unwrap().as_mapping().unwrap();
@@ -1083,8 +1088,10 @@ pub async fn pipeline_failure(
10831088
}
10841089
}
10851090
}
1086-
exit_code = common::EXIT_CODE_LICENSE_FAILED;
1087-
exit_msg = common::LICENSE_FAILED_MSG.to_string();
1091+
if is_pipeline_failed {
1092+
exit_code = common::EXIT_CODE_LICENSE_FAILED;
1093+
exit_msg = common::LICENSE_FAILED_MSG.to_string();
1094+
}
10881095
}
10891096
if is_pipeline_failed {
10901097
println!("\n\n");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy