我要评分
获取效率
正确性
完整性
易理解

Jenkins Pipeline Sample Code

Without A-FOT

The sample code is as follows:

pipeline {
    agent any    options {
        timeout(time: 1, unit: 'HOURS')
    }
    stages{
        stage('build') {
            agent {
                label 'kunpeng_c_builder_gcc'
            }
            steps{
                # After the installation is complete, the GCC for openEuler environment is available. The compilation commands are the same as those on other platforms.
                  cd /home/test
                # Run the original build script.
                  sh build.sh
            }
        }
    }
}

/home/test indicates the project file path. Replace it with the actual path.

With A-FOT (Configuration File Parameter Optimization)

The sample code is as follows:

pipeline {
    agent any    options {
        timeout(time: 1, unit: 'HOURS')
    }
    stages{
        stage('A-FOT') {
            agent {
                label 'kunpeng_c_builder_gcc'
            }
            steps{
                # After the installation is complete, the GCC for openEuler environment is available. The compilation commands are the same as those on other platforms.
                #################################
                # Replace it with the actual compilation command. #
                #################################
                sh 'a-fot --config_file a-fot.ini'
            }
        }
    }
}

With A-FOT (Command Line Parameter Optimization)

The sample code is as follows:

pipeline {
    agent any    options {
        timeout(time: 1, unit: 'HOURS')
    }
    stages{
        stage('A-FOT') {
            agent {
                label 'kunpeng_c_builder_gcc'
            }
            steps{
		sh 'a-fot --opt_mode AutoFDO --gcc_path /usr --run_script /root/run.sh --build_script /root/build.sh --build_mode Wrapper --work_path ./ --bin_file /tmp/test'
            }
        }
    }
}

The optimization mode is AutoFDO, the GCC path is /usr, the application running script path is /root/run.sh, the application build script path is /root/build.sh, the build mode is Wrapper, and the script working directory is the current directory, and the executable binary path is /tmp/test. Replace them with the actual ones.