Skip to content

Commit

Permalink
Fixed exit_code issue in pipeline.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitcoder committed Aug 27, 2024
1 parent 6209c85 commit 58b7e41
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v5
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v6
1 change: 0 additions & 1 deletion src/utils/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ pub async fn insert_job_info(
.into_iter()
.map(|v| to_bson(&v).unwrap_or(Bson::Null))
.collect();

// Create the document to insert
let document = doc! {
"job_id": job_id,
Expand Down
25 changes: 16 additions & 9 deletions src/utils/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,10 @@ pub async fn pipeline_failure(
}
}
}
exit_code = common::EXIT_CODE_SAST_FAILED;
exit_msg = common::SAST_FAILED_MSG.to_string();
if is_pipeline_failed {
exit_code = common::EXIT_CODE_SAST_FAILED;
exit_msg = common::SAST_FAILED_MSG.to_string();
}
}

if is_sca && sca_policy.is_some() {
Expand Down Expand Up @@ -999,8 +1001,10 @@ pub async fn pipeline_failure(
}
}
}
exit_code = common::EXIT_CODE_SCA_FAILED;
exit_msg = common::SCA_FAILED_MSG.to_string();
if is_pipeline_failed {
exit_code = common::EXIT_CODE_SCA_FAILED;
exit_msg = common::SCA_FAILED_MSG.to_string();
}
}

if is_secret && secret_policy.is_some() {
Expand Down Expand Up @@ -1056,9 +1060,10 @@ pub async fn pipeline_failure(
}
}
}

exit_code = common::EXIT_CODE_SECRET_FAILED;
exit_msg = common::SECRET_FAILED_MSG.to_string();
if is_pipeline_failed {
exit_code = common::EXIT_CODE_SECRET_FAILED;
exit_msg = common::SECRET_FAILED_MSG.to_string();
}
}
if is_license_compliance && license_policy.is_some() {
let license_policy = license_policy.unwrap().as_mapping().unwrap();
Expand All @@ -1083,8 +1088,10 @@ pub async fn pipeline_failure(
}
}
}
exit_code = common::EXIT_CODE_LICENSE_FAILED;
exit_msg = common::LICENSE_FAILED_MSG.to_string();
if is_pipeline_failed {
exit_code = common::EXIT_CODE_LICENSE_FAILED;
exit_msg = common::LICENSE_FAILED_MSG.to_string();
}
}
if is_pipeline_failed {
println!("\n\n");
Expand Down

0 comments on commit 58b7e41

Please sign in to comment.