@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
10
10
exports.POLARIS_SERVERURL_KEY = exports.POLARIS_ASSESSMENT_TYPES_KEY = exports.POLARIS_PROJECT_NAME_KEY = exports.POLARIS_APPLICATION_NAME_KEY = exports.POLARIS_ACCESS_TOKEN_KEY = exports.POLARIS_ACCESSTOKEN_KEY = exports.COVERITY_VERSION_KEY = exports.BRIDGE_COVERITY_VERSION_KEY = exports.COVERITY_LOCAL_KEY = exports.COVERITY_PRCOMMENT_ENABLED_KEY = exports.COVERITY_AUTOMATION_PRCOMMENT_KEY = exports.COVERITY_ARGS_KEY = exports.COVERITY_CONFIG_PATH_KEY = exports.COVERITY_CLEAN_COMMAND_KEY = exports.COVERITY_BUILD_COMMAND_KEY = exports.COVERITY_WAITFORSCAN_KEY = exports.COVERITY_POLICY_VIEW_KEY = exports.COVERITY_INSTALL_DIRECTORY_KEY = exports.COVERITY_STREAM_NAME_KEY = exports.COVERITY_PROJECT_NAME_KEY = exports.COVERITY_PASSPHRASE_KEY = exports.COVERITY_USER_KEY = exports.COVERITY_URL_KEY = exports.DETECT_EXECUTION_PATH_KEY = exports.BLACKDUCK_EXECUTION_PATH_KEY = exports.COVERITY_EXECUTION_PATH_KEY = exports.SRM_WAITFORSCAN_KEY = exports.SRM_BRANCH_PARENT_KEY = exports.SRM_BRANCH_NAME_KEY = exports.SRM_PROJECT_ID_KEY = exports.SRM_PROJECT_NAME_KEY = exports.SRM_ASSESSMENT_TYPES_KEY = exports.SRM_API_KEY = exports.SRM_URL_KEY = exports.SRM_KEY = exports.BLACKDUCK_KEY = exports.POLARIS_KEY = exports.COVERITY_KEY = exports.MIN_SUPPORTED_BRIDGE_CLI_MAC_ARM_VERSION = exports.BRIDGE_CLI_DOWNLOAD_VERSION_KEY = exports.BRIDGE_DOWNLOAD_VERSION_KEY = exports.BRIDGE_CLI_DOWNLOAD_URL_KEY = exports.BRIDGE_DOWNLOAD_URL_KEY = exports.BRIDGE_CLI_INSTALL_DIRECTORY_KEY = exports.BRIDGE_INSTALL_DIRECTORY_KEY = exports.APPLICATION_NAME = exports.BRIDGE_CLI_ARTIFACTORY_URL = exports.BRIDGE_CLI_DEFAULT_PATH_LINUX = exports.BRIDGE_CLI_DEFAULT_PATH_WINDOWS = exports.BRIDGE_CLI_DEFAULT_PATH_MAC = void 0;
11
11
exports.BLACKDUCKSCA_UPLOAD_SARIF_REPORT_KEY = exports.BLACKDUCK_UPLOAD_SARIF_REPORT_KEY = exports.BLACKDUCKSCA_REPORTS_SARIF_GROUP_SCA_ISSUES_KEY = exports.BLACKDUCK_REPORTS_SARIF_GROUP_SCA_ISSUES_KEY = exports.BLACKDUCKSCA_REPORTS_SARIF_SEVERITIES_KEY = exports.BLACKDUCK_REPORTS_SARIF_SEVERITIES_KEY = exports.BLACKDUCKSCA_REPORTS_SARIF_FILE_PATH_KEY = exports.BLACKDUCK_REPORTS_SARIF_FILE_PATH_KEY = exports.BLACKDUCKSCA_REPORTS_SARIF_CREATE_KEY = exports.BLACKDUCK_REPORTS_SARIF_CREATE_KEY = exports.BLACKDUCKSCA_PRCOMMENT_ENABLED_KEY = exports.BLACKDUCK_PRCOMMENT_ENABLED_KEY = exports.BLACKDUCKSCA_FIXPR_UPGRADE_GUIDANCE_KEY = exports.BLACKDUCK_FIXPR_USE_UPGRADE_GUIDANCE_KEY = exports.BLACKDUCKSCA_FIXPR_FILTER_SEVERITIES_KEY = exports.BLACKDUCK_FIXPR_FILTER_SEVERITIES_KEY = exports.BLACKDUCKSCA_FIXPR_CREATE_SINGLE_PR_KEY = exports.BLACKDUCK_FIXPR_CREATE_SINGLE_PR_KEY = exports.BLACKDUCKSCA_FIXPR_MAX_COUNT_KEY = exports.BLACKDUCK_FIXPR_MAXCOUNT_KEY = exports.BLACKDUCKSCA_FIXPR_ENABLED_KEY = exports.BLACKDUCK_FIXPR_ENABLED_KEY = exports.BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES_KEY = exports.BLACKDUCK_SCAN_FAILURE_SEVERITIES_KEY = exports.BLACKDUCKSCA_SCAN_FULL_KEY = exports.BLACKDUCK_SCAN_FULL_KEY = exports.DETECT_INSTALL_DIRECTORY_KEY = exports.BLACKDUCK_INSTALL_DIRECTORY_KEY = exports.BLACKDUCKSCA_TOKEN_KEY = exports.BLACKDUCK_TOKEN_KEY = exports.BLACKDUCKSCA_URL_KEY = exports.BLACKDUCK_URL_KEY = exports.PROJECT_DIRECTORY_KEY = exports.PROJECT_SOURCE_EXCLUDES_KEY = exports.PROJECT_SOURCE_PRESERVESYMLINKS_KEY = exports.PROJECT_SOURCE_ARCHIVE_KEY = exports.POLARIS_ASSESSMENT_MODE_KEY = exports.POLARIS_WAITFORSCAN_KEY = exports.POLARIS_UPLOAD_SARIF_REPORT_KEY = exports.POLARIS_REPORTS_SARIF_ISSUE_TYPES_KEY = exports.POLARIS_REPORTS_SARIF_GROUP_SCA_ISSUES_KEY = exports.POLARIS_REPORTS_SARIF_SEVERITIES_KEY = exports.POLARIS_REPORTS_SARIF_FILE_PATH_KEY = exports.POLARIS_REPORTS_SARIF_CREATE_KEY = exports.POLARIS_TEST_SCA_TYPE_KEY = exports.POLARIS_BRANCH_PARENT_NAME_KEY = exports.POLARIS_BRANCH_NAME_KEY = exports.POLARIS_PRCOMMENT_SEVERITIES_KEY = exports.POLARIS_PRCOMMENT_ENABLED_KEY = exports.POLARIS_SERVER_URL_KEY = void 0;
12
12
exports.BRIDGE_EXECUTABLE_NOT_FOUND_ERROR = exports.BRIDGE_CLI_URL_EMPTY_ERROR = exports.PROVIDED_BRIDGE_CLI_URL_EMPTY_ERROR = exports.BRIDGE_CLI_URL_NOT_VALID_ERROR = exports.BRIDGE_CLI_URL_NOT_VALID_OS_ERROR = exports.BRIDGE_VERSION_NOT_FOUND_ERROR = exports.MISSING_GITHUB_TOKEN_FOR_FIX_PR_AND_PR_COMMENT_ERROR = exports.GITHUB_TOKEN_VALIDATION_SARIF_UPLOAD_ERROR = exports.BLACKDUCK_FIXPR_LOG_INFO_FOR_PR_SCANS = exports.BLACKDUCK_PR_COMMENT_LOG_INFO_FOR_NON_PR_SCANS = exports.COVERITY_PR_COMMENT_LOG_INFO_FOR_NON_PR_SCANS = exports.POLARIS_PR_COMMENT_LOG_INFO_FOR_NON_PR_SCANS = exports.SARIF_REPORT_LOG_INFO_FOR_PR_SCANS = exports.GITHUB_ENVIRONMENT_VARIABLES = exports.HTTP_STATUS_FORBIDDEN = exports.HTTP_STATUS_ACCEPTED = exports.HTTP_STATUS_OK = exports.SECONDARY_RATE_LIMIT = exports.X_RATE_LIMIT_REMAINING = exports.X_RATE_LIMIT_RESET = exports.SARIF_DEFAULT_FILE_NAME = exports.POLARIS_SARIF_ARTIFACT_NAME = exports.POLARIS_SARIF_GENERATOR_DIRECTORY = exports.BLACKDUCK_SARIF_ARTIFACT_NAME = exports.BLACKDUCK_SARIF_GENERATOR_DIRECTORY = exports.BRIDGE_LOCAL_DIRECTORY = exports.GITHUB_CLOUD_API_URL = exports.GITHUB_CLOUD_URL = exports.NON_RETRY_HTTP_CODES = exports.RETRY_COUNT = exports.RETRY_DELAY_IN_MILLISECONDS = exports.EXIT_CODE_MAP = exports.DIAGNOSTICS_RETENTION_DAYS_KEY = exports.NETWORK_AIRGAP_KEY = exports.BRIDGE_NETWORK_AIRGAP_KEY = exports.INCLUDE_DIAGNOSTICS_KEY = exports.GITHUB_TOKEN_KEY = exports.GITHUB_HOST_URL_KEY = exports.BLACKDUCKSCA_POLICY_BADGES_MAX_COUNT_KEY = exports.BLACKDUCK_POLICY_BADGES_MAX_COUNT_KEY = exports.BLACKDUCKSCA_POLICY_BADGES_CREATE_KEY = exports.BLACKDUCK_POLICY_BADGES_CREATE_KEY = exports.DETECT_ARGS_KEY = exports.BLACKDUCK_ARGS_KEY = exports.DETECT_CONFIG_PATH_KEY = exports.BLACKDUCK_CONFIG_PATH_KEY = exports.DETECT_SEARCH_DEPTH_KEY = exports.BLACKDUCK_SEARCH_DEPTH_KEY = exports.BLACKDUCKSCA_WAITFORSCAN_KEY = exports.BLACKDUCK_WAITFORSCAN_KEY = void 0;
13
- exports.EXIT_CODE_ERROR = exports.TASK_RETURN_STATUS = exports.MARK_BUILD_STATUS_DEFAULT = exports.BUILD_STATUS = exports.MARK_BUILD_STATUS_KEY = exports.RETURN_STATUS_KEY = exports.POLARIS_POLICY_BADGES_MAX_COUNT_KEY = exports.POLARIS_POLICY_BADGES_CREATE_KEY = exports.WINDOWS_PLATFORM_NAME = exports.LINUX_PLATFORM_NAME = exports.MAC_PLATFORM_NAME = exports.SARIF_FILE_NO_FOUND_FOR_UPLOAD_ERROR = exports.SARIF_GAS_UPLOAD_FAILED_ERROR = exports.SARIF_GAS_API_RATE_LIMIT_FOR_ERROR = exports.PROVIDED_BLACKDUCKSCA_FAILURE_SEVERITIES_ERROR = exports.MISSING_BOOLEAN_VALUE_ERROR = exports.INVALID_VALUE_ERROR = exports.BRIDGE_DOWNLOAD_RETRY_ERROR = exports.BRIDGE_EXTRACT_directory_NOT_FOUND_ERROR = exports.BRIDGE_ZIP_NOT_FOUND_FOR_EXTRACT_ERROR = exports.SCAN_TYPE_REQUIRED_ERROR = exports.BRIDGE_DEFAULT_DIRECTORY_NOT_FOUND_ERROR = exports.BRIDGE_INSTALL_DIRECTORY_NOT_FOUND_ERROR = void 0;
13
+ exports.BRIDGE_BREAK_EXIT_CODE = exports.TASK_RETURN_STATUS = exports.MARK_BUILD_STATUS_DEFAULT = exports.BUILD_STATUS = exports.MARK_BUILD_STATUS_KEY = exports.RETURN_STATUS_KEY = exports.POLARIS_POLICY_BADGES_MAX_COUNT_KEY = exports.POLARIS_POLICY_BADGES_CREATE_KEY = exports.WINDOWS_PLATFORM_NAME = exports.LINUX_PLATFORM_NAME = exports.MAC_PLATFORM_NAME = exports.SARIF_FILE_NO_FOUND_FOR_UPLOAD_ERROR = exports.SARIF_GAS_UPLOAD_FAILED_ERROR = exports.SARIF_GAS_API_RATE_LIMIT_FOR_ERROR = exports.PROVIDED_BLACKDUCKSCA_FAILURE_SEVERITIES_ERROR = exports.MISSING_BOOLEAN_VALUE_ERROR = exports.INVALID_VALUE_ERROR = exports.BRIDGE_DOWNLOAD_RETRY_ERROR = exports.BRIDGE_EXTRACT_directory_NOT_FOUND_ERROR = exports.BRIDGE_ZIP_NOT_FOUND_FOR_EXTRACT_ERROR = exports.SCAN_TYPE_REQUIRED_ERROR = exports.BRIDGE_DEFAULT_DIRECTORY_NOT_FOUND_ERROR = exports.BRIDGE_INSTALL_DIRECTORY_NOT_FOUND_ERROR = void 0;
14
14
exports.BRIDGE_CLI_DEFAULT_PATH_MAC = '/bridge-cli-bundle'; //Path will be in home
15
15
exports.BRIDGE_CLI_DEFAULT_PATH_WINDOWS = '\\bridge-cli-bundle';
16
16
exports.BRIDGE_CLI_DEFAULT_PATH_LINUX = '/bridge-cli-bundle';
@@ -302,7 +302,7 @@ var BUILD_STATUS;
302
302
})(BUILD_STATUS = exports.BUILD_STATUS || (exports.BUILD_STATUS = {}));
303
303
exports.MARK_BUILD_STATUS_DEFAULT = BUILD_STATUS.FAILURE;
304
304
exports.TASK_RETURN_STATUS = 'status';
305
- exports.EXIT_CODE_ERROR = 8;
305
+ exports.BRIDGE_BREAK_EXIT_CODE = 8;
306
306
307
307
308
308
/***/ }),
@@ -2740,7 +2740,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
2740
2740
});
2741
2741
};
2742
2742
Object.defineProperty(exports, "__esModule", ({ value: true }));
2743
- exports.getBridgeExitCode = exports.getBridgeExitCodeAsNumericValue = exports.logBridgeExitCodes = exports.run = void 0;
2743
+ exports.markBuildStatusIfIssuesArePresent = exports. getBridgeExitCode = exports.getBridgeExitCodeAsNumericValue = exports.logBridgeExitCodes = exports.run = void 0;
2744
2744
const core_1 = __nccwpck_require__(42186);
2745
2745
const utility_1 = __nccwpck_require__(4201);
2746
2746
const bridge_cli_1 = __nccwpck_require__(61848);
@@ -2775,24 +2775,19 @@ function run() {
2775
2775
(0, core_1.info)('Black Duck Security Action workflow execution completed successfully.');
2776
2776
isBridgeExecuted = true;
2777
2777
}
2778
- return exitCode;
2779
- }
2780
- catch (error) {
2781
- const err = error;
2782
- exitCode = getBridgeExitCodeAsNumericValue(err);
2783
- if (exitCode === constants.EXIT_CODE_ERROR && (0, utility_1.checkJobResult)(inputs.MARK_BUILD_STATUS) === constants.BUILD_STATUS.SUCCESS) {
2784
- (0, core_1.info)(`Workflow failed! ${logBridgeExitCodes(err.message)}.\nMarking the build ${inputs.MARK_BUILD_STATUS} as configured in the task.`);
2785
- isBridgeExecuted = true;
2786
- }
2787
- else
2788
- throw error;
2789
- }
2790
- finally {
2791
2778
// The statement set the exit code in the 'status' variable which can be used in the YAML file
2792
2779
if ((0, utility_1.parseToBoolean)(inputs.RETURN_STATUS)) {
2793
2780
(0, core_1.debug)(`Setting output variable ${constants.TASK_RETURN_STATUS} with exit code ${exitCode}`);
2794
2781
(0, core_1.setOutput)(constants.TASK_RETURN_STATUS, exitCode);
2795
2782
}
2783
+ return exitCode;
2784
+ }
2785
+ catch (error) {
2786
+ exitCode = getBridgeExitCodeAsNumericValue(error);
2787
+ isBridgeExecuted = getBridgeExitCode(error);
2788
+ throw error;
2789
+ }
2790
+ finally {
2796
2791
const uploadSarifReportBasedOnExitCode = exitCode === 0 || exitCode === 8;
2797
2792
(0, core_1.debug)(`Bridge CLI execution completed: ${isBridgeExecuted}`);
2798
2793
if (isBridgeExecuted) {
@@ -2849,12 +2844,35 @@ function getBridgeExitCode(error) {
2849
2844
return false;
2850
2845
}
2851
2846
exports.getBridgeExitCode = getBridgeExitCode;
2852
- run().catch(error => {
2853
- if (error.message != undefined) {
2854
- (0, core_1.setFailed)('Workflow failed! '.concat(logBridgeExitCodes(error.message)));
2847
+ function markBuildStatusIfIssuesArePresent(status, taskResult, errorMessage) {
2848
+ const exitMessage = logBridgeExitCodes(errorMessage);
2849
+ if (status === constants.BRIDGE_BREAK_EXIT_CODE) {
2850
+ (0, core_1.debug)(errorMessage);
2851
+ if (taskResult === constants.BUILD_STATUS.SUCCESS) {
2852
+ (0, core_1.info)(exitMessage);
2853
+ }
2854
+ (0, core_1.info)(`Marking the build ${taskResult} as configured in the task.`);
2855
2855
}
2856
2856
else {
2857
- (0, core_1.setFailed)('Workflow failed! '.concat(logBridgeExitCodes(error)));
2857
+ (0, core_1.setFailed)('Workflow failed! '.concat(logBridgeExitCodes(exitMessage)));
2858
+ }
2859
+ }
2860
+ exports.markBuildStatusIfIssuesArePresent = markBuildStatusIfIssuesArePresent;
2861
+ run().catch(error => {
2862
+ if (error.message !== undefined) {
2863
+ const isReturnStatusEnabled = (0, utility_1.parseToBoolean)(inputs.RETURN_STATUS);
2864
+ const exitCode = getBridgeExitCodeAsNumericValue(error);
2865
+ if (isReturnStatusEnabled) {
2866
+ (0, core_1.debug)(`Setting output variable ${constants.TASK_RETURN_STATUS} with exit code ${exitCode}`);
2867
+ (0, core_1.setOutput)(constants.TASK_RETURN_STATUS, exitCode);
2868
+ }
2869
+ const taskResult = (0, utility_1.checkJobResult)(inputs.MARK_BUILD_STATUS);
2870
+ if (taskResult && taskResult !== constants.BUILD_STATUS.FAILURE) {
2871
+ markBuildStatusIfIssuesArePresent(exitCode, taskResult, error.message);
2872
+ }
2873
+ else {
2874
+ (0, core_1.setFailed)('Workflow failed! '.concat(logBridgeExitCodes(error.message)));
2875
+ }
2858
2876
}
2859
2877
});
2860
2878
0 commit comments