HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Minimal CMake Jenkinsfile failing

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
minimaljenkinsfilecmakefailing

Problem

Why is this Jenkins build failing? How can I write a Jenkins file just to test the building of this simple project?

DisplayImage.cpp

#include 
#include 

using namespace cv;

int main(int argc, char** argv )
{
    if ( argc != 2 )
    {
        printf("usage: DisplayImage.out \n");
        return -1;
    }

    Mat image;
    image = imread( argv[1], 1 );

    if ( !image.data )
    {
        printf("No image data \n");
        return -1;
    }
    namedWindow("Display Image", WINDOW_AUTOSIZE );
    imshow("Display Image", image);

    waitKey(0);

    return 0;
}


CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )


Jenkinsfile

pipeline {
    agent any
    stages {
        stage('build') {
            steps {
                cmakeBuild
                installation: 'InSearchPath'
            }
        }
    }
}


Output from Jenkins

WorkflowScript: 6: Expected a step @ line 6, column 17.
                   cmakeBuild
                   ^

WorkflowScript: 7: Expected a step @ line 7, column 31.
                   installation: 'InSearchPath'

Solution

Verify that you have the correct CMake Plugin installed. Also, add parenthesis to your cmakeBuild statement in your pipeline

pipeline {
  agent any
  stages {
    stage('build') {
      steps {
          cmakeBuild(
            installation: 'InSearchPath'
          )
      }
    }
  }
}

Code Snippets

pipeline {
  agent any
  stages {
    stage('build') {
      steps {
          cmakeBuild(
            installation: 'InSearchPath'
          )
      }
    }
  }
}

Context

StackExchange DevOps Q#10634, answer score: 3

Revisions (0)

No revisions yet.