jenkinsci / fortify-on-demand-uploader-plugin

Fortify on Demand Uploader
https://plugins.jenkins.io/fortify-on-demand-uploader/
8 stars 37 forks source link

Plugin does not fail Jenkins build when failing policy #118

Open jbisabel opened 3 years ago

jbisabel commented 3 years ago

Jenkins version: 2.289.2 LTS Plugin version: 6.1.0

Reproduction steps

Create a pipeline with the following pipeline step:

        stage('Fortify check') {
            steps {
                fodStaticAssessment bsiToken: '',
                    entitlementPreference: 'SubscriptionOnly',
                    inProgressBuildResultType: 'WarnBuild',
                    inProgressScanActionType: 'Queue',
                    releaseId: '12345',
                    remediationScanPreferenceType: 'RemediationScanIfAvailable',
                    srcLocation: 'src/main/java'

                fodPollResults bsiToken: '',
                    policyFailureBuildResultPreference: 2,
                    pollingInterval: 2,
                    releaseId: '12345'
            }

            post {
                always {
                    script {
                        echo currentBuild.result
                    }
                }
            }
        }

Results

Expected result: With policyFailureBuildResultPreference: 2 I'd expect the currentBuild.result status to be set to FAILURE and the job to be terminated.

Actual result: The build status is SUCCESS regardless of scan result and the job continues unhindered

11:45:20  Begin polling Fortify on Demand for results.
11:45:20  1) Poll Status: Queued
11:47:21  2) Poll Status: Completed
11:47:21  Critical: 0
11:47:21  High:     1
11:47:21  Medium:   0
11:47:21  Low:      0
11:47:21  For application status details see the customer portal: 
11:47:21  https://emea.fortify.com/Redirect/Releases/12345
11:47:21  Scan failed established policy check
11:47:21  Failure Reason:         Pass/Fail Policy requirements not met 
Post stage
[Pipeline] script
[Pipeline] {
[Pipeline] echo
11:47:21  SUCCESS
berabulut commented 2 years ago

I am experiencing same problem with a Freestyle Project. I used same configs with this video.