Rate This Document
Findability
Accuracy
Completeness
Readability

Sample Code for GitLab Pipeline Gated Check-in Scanning

Sample code for source code porting and byte alignment check:

stages:  
  - build    
  - migrating-applications
  - affinity-analysis
source-code-migration:
  stage: migrating-applications
  tags:
    - kunpeng_scanner # This is the tag used during gitlab-runner registration. Multiple tags may be selected.
  script:
    - echo '====== Source code porting ======'
    - devkit porting src-mig -i /home/TestData/wtdbg2-2.5 -c make -r html || [ $? -eq 1 ] && echo 'Warning: The scan report contains suggestion items.
    
    # Example: devkit porting src-mig -i /home/TestData/wtdbg2-2.5 -c make -r html || [ $? -eq 1 ] && echo 'Warning: The scan report contains suggestion items.
    - mv ./src-mig*.html ./SourceCodeScanningReport.html
  artifacts:
    paths:
      - SourceCodeScanningReport.html
    name: src-mig
byte-alignment-check:
  stage: affinity-analysis
  tags:
    - kunpeng_scanner # This is the tag used during gitlab-runner registration. Multiple tags may be selected.
  script:
    - echo '====== Byte alignment check ======'
    - devkit advisor addr-align -i /opt/DevKit/wtdbg2-2.5 -c make -r html
    - mv ./addr-align*.html ./byte-alignment-check.html
  artifacts:
    paths:
      - byte-alignment-check.html
    name: byte-align
  • /home/TestData/wtdbg2-2.5 indicates the path to the source code folder or package to be scanned. Replace it with the actual path.
  • /opt/DevKit/wtdbg2-2.5 indicates the path to the source code folder to be scanned. Replace it with the actual path.