开发者
资源
【最新KADC现场试验发布】:体验Kunpeng Devkit开发者社区
【最新KADC现场试验发布】:体验Kunpeng Devkit开发者社区
新人帖
发表于2024/05/09
10k4

KADC现场报道

2024鲲鹏开发者大会前方:

挺好的,Kunpeng Devkit 新版本,在这种环境下

Show you code:

pipeline {
    agent any
    options {
        timeout(time: 1, unit: 'HOURS')
    }
    stages{
        stage('git-clone-code') {
            agent {
                label 'kunpeng_c_cpp_builder'
            }
            steps {
                echo '====== 获取源码 ======'
                sh '''
                if [ -d c_demo ]; then rm -rf c_demo; fi
                git clone https://gitee.com/devkit-pipeline/c_demo.git
                '''
            }
        }
        stage('PARALLEL BUILD') {
            parallel {
                stage('Kunpeng') {
                    agent {
                        label 'kunpeng_c_cpp_builder'
                    }

                    stages{
                        stage('source-code-migration') {
                            steps {
                                echo '====== 源码迁移 ======'
                                script{
                                    def STATUS_CODE = sh(returnStatus: true, script: '''
                                                        /usr/bin/rm -rf ./src-mig*.html ./SourceCodeScanningReport.html
                                                        devkit porting src-mig -i ./c_demo -c make -r html
                                                        ''')
                                    sh '''
                                        html_file_name=$(find ./ -name src-mig*.html)
                                        if [[ ${html_file_name} ]]; then 
                                            mv ${html_file_name} ./SourceCodeScanningReport.html
                                        fi
                                    '''
                                    switch(STATUS_CODE) {
                                        case 0:
                                            echo '【源码迁移】--> 无扫描建议 <--'
                                            break
                                        case 1:
                                            currentBuild.result = 'UNSTABLE'
                                            echo '【源码迁移】--> 扫描结果只存在建议项 <--'
                                            break
                                        case 3:
                                            currentBuild.result = 'ABORTED'
                                            echo '【源码迁移】--> 扫描结果超时 <--'
                                            break
                                        case 4:
                                            currentBuild.result = 'ABORTED'
                                            echo '【源码迁移】--> 扫描命令错误 <--'
                                            break
                                        case 5:
                                            currentBuild.result = 'FAILURE'
                                            echo '【源码迁移】--> 扫描结果存在必须修改项 <--'
                                            error('【源码迁移】--> 扫描结果存在必须修改项 <--')
                                            break
                                        default:
                                            currentBuild.result = 'ABORTED'
                                            echo '【源码迁移】--> 异常终断开{Ctrl + C | Ctrl + Z} <--'
                                            break
                                    }
                                }
                            }
                            post {
                                always {
                                    publishHTML(target: [allowMissing: false,
                                                alwaysLinkToLastBuild: false,
                                                keepAll              : true,
                                                reportDir            : '.',
                                                reportFiles          : 'SourceCodeScanningReport.html',
                                                reportName           : 'Source Code Scanning Report']
                                                )
                                }
                            }
                        }
                        stage('64-bit-running-mode-check') {
                            steps {
                                echo '====== 64位运行模式 ======'
                                sh '''
                                    /usr/bin/rm -rf ./mode_check*.html 
                                    devkit advisor mode-check -i ./c_demo -r html
                                    mv ./mode_check*.html ./64-bit-running-mode-check.html
                                '''
                            }
                            post {
                                always {
                                    publishHTML(target: [allowMissing: false,
                                                         alwaysLinkToLastBuild: false,
                                                         keepAll              : true,
                                                         reportDir            : '.',
                                                         reportFiles          : '64-bit-running-mode-check.html',
                                                         reportName           : '64-bit-running-mode-check Report']
                                    )
                                }
                            }
                        }
                        stage('byte-alignment-check') {
                            steps {
                                echo '====== 字节对齐检查 ======'
                                sh '''
                                    /usr/bin/rm -rf ./byte-align*.html
                                    devkit advisor byte-align -i ./c_demo -c make -b make -r html
                                    mv ./byte-align*.html ./byte-alignment-check.html
                                '''
                            }
                            post {
                                always {
                                    publishHTML(target: [allowMissing: false,
                                                alwaysLinkToLastBuild: false,
                                                keepAll              : true,
                                                reportDir            : '.',
                                                reportFiles          : 'byte-alignment-check.html',
                                                reportName           : 'byte-alignment-check Report']
                                                )
                                }
                            }
                        }
                        stage('build') {
                            steps {
                                 sh '''
                                    cd ./c_demo
                                    make -j
                                    '''
                            }
               
                        }
                        stage('lkp test') {
                            steps {
                                script{
                                    echo '====== lkp test ======'
                                    sh '''
                                        CURDIR=$(pwd)
                                        cp -rf /root/.local/compatibility_testing/template.html.bak /root/.local/compatibility_testing/template.html
                                        sudo /root/.local/lkp-tests/bin/lkp run /root/.local/lkp-tests/programs/compatibility-test/compatibility-test-defaults.yaml
                                        cp -rf /root/.local/compatibility_testing/compatibility_report.html $CURDIR/compatibility_report.html
                                        sudo sh /root/.local/compatibility_testing/report_result.sh
                    
                                    '''
                                    }
                                }
                            post {
                                always {
                                    publishHTML(target: [allowMissing: false,
                                            alwaysLinkToLastBuild: false,
                                                        keepAll              : true,
                                            reportDir            : '.',
                                            reportFiles          : 'compatibility_report.html',
                                            reportName           : 'compatibility test Report']
                                    )
                                }
                            }
                        }
                        stage('clamscan') {
                                steps
                                   {
                                echo '======病毒扫描======'
                                sh 'clamscan -i -r ./ -l ./clamscan.log'
                                    }
                                }

                    }
                }
                stage('x86_64') {
                    agent any
                    stages{
                        stage('x86_64 pipeline'){
                            steps {
                              echo '====== x86_64 pipeline ======'
                            }
                        }
                    }
                }
            }
        }
    }
}

可以直接在相关的环境中,使用Jeckin

在不改变您原有流水线的情况下,快速接入鲲鹏构建能力,使您能够使用一套代码,一套流水线,同时支持x86/鲲鹏多样性算力版本构建及测试,提升您的版本开发、发布效率。3 鲲鹏DevKit流水线工具介绍流水线总体分为代码开发、门禁检查、编译构建、调优、测试等几个关键步骤。针对每个步骤,DevKit流水线工具通过下载和部署工具,将基础组件批量推送至对应节点进行安装。并且会提供毕昇编译器、毕昇JDK、GCC for openEuler、迁移扫描工具、亲和扫描工具、DevKit测试平台、A-FOT以及病毒扫描的集成指南、参考实现等文字性资料指导用户将鲲鹏架构的执行机对接至原有CICD流水线。4 鲲鹏DevKit流水线工具使用4.1 准备工作进入沙箱环境【实验操作桌面】, 打开浏览器输入htp://124.70.213.150:8080/ 如下图所示:

Kunpeng Devkit 的分享就这样啦

收藏举报
Level 1
0
帖子
0
粉丝
0
获赞