0

我正在尝试使用 Jenkins Pipeline 在 docker 容器中构建一个 cmake 项目。

cmake ..命令只是在中间失败,没有任何错误消息

+ cmake ..
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
[Pipeline] }
[Pipeline] // stage

[Pipeline] }

但是,当我在同一个 docker 容器中手动运行同一个工作目录时,它一切正常。有什么问题,我什至如何开始尝试调试呢?请参阅下面的管道脚本

#!groovy
node('agent') {
  currentBuild.description = "${env.GEPARD_PACKAGE}"

  docker.withRegistry("${env.DOCKER_REGISTRY_HOST}") {
    docker.image("gepard-devel-base").inside {

      def gepard_deps
      def build_deps

      stage('Resolve Dependencies') {
        def server = 'http://xxx.local/users/xxx'
        def script = "$server/repos/pipeline/raw/depends\\?at\\=refs%2Fheads%2Fmaster"

        gepard_deps = sh (
          script: "wget $script -O - | bash -s $env.GEPARD_PACKAGE",
          returnStdout: true
        ).trim().split('\n').findAll {pkg -> "${pkg}" != ""} as List<String>

        build_deps = [
          'cmakemodules'
        ] as List<String>

        println build_deps
      }

      stage('Checkout Dependencies') {
        def all_deps = [] as List<String>
        all_deps.addAll(gepard_deps)
        all_deps.addAll(build_deps)
        all_deps.each {
          dir("${it}") {
            git url: "http://xxx/scm/gp/${it}.git"
          }
        }
      }

      stage('Checkout Project') {
        dir("${env.GEPARD_PACKAGE}") {
          git url: "http://xxx/scm/gp/${env.GEPARD_PACKAGE}.git"
        }
      }

      stage('Create Superproject') {
        def proj = "${env.GEPARD_PACKAGE}"
        sh """                                                                                                        
           mkdir -p superproject                                                                                      
           echo 'cmake_minimum_required(VERSION 3.5)'      > superproject/CMakeLists.txt                              
           echo 'project(gepard)'                         >> superproject/CMakeLists.txt                              
           echo 'enable_testing()'                        >> superproject/CMakeLists.txt                              
           echo 'add_subdirectory(../${proj} ${proj})'    >> superproject/CMakeLists.txt                              
        """
        gepard_deps.each {
          sh "echo 'add_subdirectory(../${it} ${it})'     >> superproject/CMakeLists.txt"
        }
      }

      stage('Build GCC') {
        sh """                                                                                                        
           set -e                                                                                                     
           set -x                                                                                                     
            export GEPARD_CMAKE_MODULE_PATH=\$(pwd)/cmakemodules/CMakeGepard                                          
            ls \$GEPARD_CMAKE_MODULE_PATH                                                                             
            pushd superproject                                                                                        
            rm -rf build-gcc && mkdir -p build-gcc                                                                    
            (pushd build-gcc && cmake ..)                                                                             
            (pushd build-gcc && make)                                                                                 
        """
      }

      stage('Done') {
        sh 'echo DONE'
      }
    }
  }
}
4

0 回答 0