Rate This Document
Findability
Accuracy
Completeness
Readability

Status Code Reference

If you need to capture the status code after the scan command is executed on the Jenkins pipeline, refer to the following example status code. In the example, the status code is associated with (devkit porting src-mig -i /home/TestData/wtdbg2-2.5 -c make -r html) source code porting scanning commands.

pipeline {
    agent any
    options {
        timeout(time: 1, unit: 'HOURS')
    }
    stages{
        stage('PARALLEL BUILD') {
            agent {
                label 'kunpeng_scanner'
            }
            steps{
                script{
                    def STATUS_CODE = sh(returnStatus: true, script: 'devkit porting src-mig -i /home/TestData/wtdbg2-2.5 -c make -r html')
                    switch(STATUS_CODE) {
                        case 0:
                            currentBuild.result = 'SUCCESS'  # Final result of the custom pipeline.
                            echo '[Source Code Porting] --> No scan suggestions. <--'                          echo '
                            break
                        case 1:
                            currentBuild.result = 'UNSTABLE'
                            echo '[Source Code Porting]--> The scan result contains only suggested items. <--'
                            break
                        case 5:
                            currentBuild.result = 'FAILURE'
                            echo '[Source Code Porting] --> The scan result contains items that must be modified. <--'
                            break
                        case 3:
                            currentBuild.result = 'ABORTED'
                            echo '[Source Code Porting] --> Scan result timed out. <--'
                            break
                        case 4:
                            currentBuild.result = 'ABORTED'
                            echo '[Source Code Porting] --> Incorrect scan command. <--'
                            break
                        default:
                            currentBuild.result = 'ABORTED'
                            echo '[Source Code Porting]--> Abnormally terminated {Ctrl + C | Ctrl + Z}. <--'
                            break
                    }
                }
            }
            post{
                success{
                    echo '--> ✔ <--'
                }
                failure{
                    echo '--> ❌ <--'
                }
                unstable{
                    echo '--> ⚠ <--'
                }
            }
        }
    }
}
  • If the pipeline status is Failed and the log output shows that the source code porting scanning result contains items that must be modified, the code requires changes before it can be successfully ported to the Kunpeng platform. Therefore, the pipeline status is marked as Failed.
  • To capture status codes of other functions, modify the scan command and corresponding status code information in the example. For details about the status codes of the Porting Advisor CLI and Affinity Analyzer CLI, see Table 1 and Table 2.
Table 1 Status codes of the Porting Advisor CLI

Status Code

Trigger Condition

0

No scan suggestion is available.

1

The scan result contains only suggested items.

2

Ctrl+C(SIGINT(2)) occurs during the scan task.

3

The scan result times out.

4

The scan command is incorrect.

5

The scan result contains items that must be modified.

15/20

Ctrl+Z SIGTERM(15)/SIGTSTP(20) occurs during the scan task.

Table 2 Status codes of the Affinity Analyzer CLI

Status Code

Trigger Condition

0

No scan suggestion is available.

2

Ctrl+C(SIGINT(2)) occurs during the scan task.

3

The scan result times out.

4

The scan command is incorrect.