Declarative pipeline support for tools: CMake, custom tools

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Declarative pipeline support for tools: CMake, custom tools

Colin Bennett
It seems that the Declarative Pipeline (Pipeline Model Definition) does not support some important tools with the "tools" block, in particular the CMake tool and custom tools.

I tried all combinations I could find of things like

     tools {
         com
.cloudbees.jenkins.plugins.customtools.CustomTool "Ninja"
         
CustomTool "Ninja"
         com
.cloudbees.jenkins.plugins.customtools.CustomTool("Ninja")
         
CMake "CMake"
         custom
"Ninja"
         
Custom "Ninja"
         msys2
"MSYS2"
     
}

Where I have custom tools called "Ninja" and MSYS2, in addition to CMake tools.

Does anyone have an idea how to make Declarative Pipelines work with custom tools, and CMake?

Regards,
Colin

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e58a613f-2bba-4270-9888-5b8592f67e2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline support for tools: CMake, custom tools

ingunawa

It is not supported:

 

https://issues.jenkins-ci.org/browse/JENKINS-34998

 

 

From: <[hidden email]> on behalf of Colin Bennett <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 16, 2017 at 2:56 PM
To: Jenkins Users <[hidden email]>
Subject: Declarative pipeline support for tools: CMake, custom tools

 

It seems that the Declarative Pipeline (Pipeline Model Definition) does not support some important tools with the "tools" block, in particular the CMake tool and custom tools.

I tried all combinations I could find of things like

     tools {
         com
.cloudbees.jenkins.plugins.customtools.CustomTool "Ninja"
         
CustomTool "Ninja"
         com
.cloudbees.jenkins.plugins.customtools.CustomTool("Ninja")
         
CMake "CMake"
         custom
"Ninja"
         
Custom "Ninja"
         msys2
"MSYS2"
     
}


Where I have custom tools called "Ninja" and MSYS2, in addition to CMake tools.

Does anyone have an idea how to make Declarative Pipelines work with custom tools, and CMake?

Regards,
Colin

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e58a613f-2bba-4270-9888-5b8592f67e2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/06146F83-C614-408A-BF4D-5979D9F358B9%40cisco.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline support for tools: CMake, custom tools

Colin Bennett
Thanks for the link to that issue. But it is not really the issue I am having. I am not using the CMake build step, but only using it to get the tool in the path and get auto installers.

Same for the custom tools. Both custom tools and CMake work in the Scripted Pipeline job type but I can't get it to work in the Declarative Pipeline syntax.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e265af17-acfd-4c02-b547-1b2c963f5522%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline support for tools: CMake, custom tools

Daniel Beck

> On 17.02.2017, at 02:57, Colin Bennett <[hidden email]> wrote:
>
> Same for the custom tools. Both custom tools and CMake work in the Scripted Pipeline job type but I can't get it to work in the Declarative Pipeline syntax.

I think Andrew mentioned on Wednesday that tools need to have @Symbol annotations to work in Declarative Pipeline, i.e. JENKINS-37386

If so, there's no workaround. The plugins need to be adapted.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/C6C8DB41-FAF1-4456-A835-2B8B83CE6FBD%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline support for tools: CMake, custom tools

Frits van der Holst
In reply to this post by Colin Bennett
Hi,

Bumped into the same problem. Tools seems to be very limited with respect to the tools supported. The work around I found is like this:
    environment {
        GROOVY_HOME
= tool name: 'Groovy-2.4.9', type: 'hudson.plugins.groovy.GroovyInstallation'
   
}
    stages
{
        stage
('Run Groovy') {
            steps
{
                bat
"${groovy_home}/bin/groovy <script.name>"
           
}
       
}
   
}

I use this for multiple tools we use (cmake, groovy, innosetup.. etc..). The tool name part:
tool name: 'Groovy-2.4.9', type: 'hudson.plugins.groovy.GroovyInstallation'
Is generated using the snippet generator.

Waiting for the final solution seems to take a lot of time so this works for me right now.
Hope it helps.

Frits.





On Thursday, February 16, 2017 at 11:56:33 PM UTC+1, Colin Bennett wrote:
It seems that the Declarative Pipeline (Pipeline Model Definition) does not support some important tools with the "tools" block, in particular the CMake tool and custom tools.

I tried all combinations I could find of things like

     tools {
         com
.cloudbees.jenkins.plugins.customtools.CustomTool "Ninja"
         
CustomTool "Ninja"
         com
.cloudbees.jenkins.plugins.customtools.CustomTool("Ninja")
         
CMake "CMake"
         custom
"Ninja"
         
Custom "Ninja"
         msys2
"MSYS2"
     
}

Where I have custom tools called "Ninja" and MSYS2, in addition to CMake tools.

Does anyone have an idea how to make Declarative Pipelines work with custom tools, and CMake?

Regards,
Colin

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d8190905-e8a8-4d94-81d7-39e309eb3764%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline support for tools: CMake, custom tools

Srujana
This did not work for me since the tool type I want is of customtools type: 

tool name: 'bzip2', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'

Are there any alternatives at this point?

Thanks,
Srujana

On Friday, 6 October 2017 11:38:13 UTC-5, Frits van der Holst wrote:
Hi,

Bumped into the same problem. Tools seems to be very limited with respect to the tools supported. The work around I found is like this:
    environment {
        GROOVY_HOME
= tool name: 'Groovy-2.4.9', type: 'hudson.plugins.groovy.GroovyInstallation'
   
}
    stages
{
        stage
('Run Groovy') {
            steps
{
                bat
"${groovy_home}/bin/groovy <<a href="http://script.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fscript.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHCsDCj39pGKjqtSm7k7N4hGnTnYw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fscript.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHCsDCj39pGKjqtSm7k7N4hGnTnYw&#39;;return true;">script.name>"
           
}
       
}
   
}

I use this for multiple tools we use (cmake, groovy, innosetup.. etc..). The tool name part:
tool name: 'Groovy-2.4.9', type: 'hudson.plugins.groovy.GroovyInstallation'
Is generated using the snippet generator.

Waiting for the final solution seems to take a lot of time so this works for me right now.
Hope it helps.

Frits.





On Thursday, February 16, 2017 at 11:56:33 PM UTC+1, Colin Bennett wrote:
It seems that the Declarative Pipeline (Pipeline Model Definition) does not support some important tools with the "tools" block, in particular the CMake tool and custom tools.

I tried all combinations I could find of things like

     tools {
         com
.cloudbees.jenkins.plugins.customtools.CustomTool "Ninja"
         
CustomTool "Ninja"
         com
.cloudbees.jenkins.plugins.customtools.CustomTool("Ninja")
         
CMake "CMake"
         custom
"Ninja"
         
Custom "Ninja"
         msys2
"MSYS2"
     
}

Where I have custom tools called "Ninja" and MSYS2, in addition to CMake tools.

Does anyone have an idea how to make Declarative Pipelines work with custom tools, and CMake?

Regards,
Colin

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0fa59f64-acf3-4af8-8f52-352f8348b5ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline support for tools: CMake, custom tools

Colin Bennett
The workaround of use the 'tool' function in the environment PATH assignment is working for me.

Here is an example:

pipeline {
    agent
{ label "windows" }
    environment
{
        PATH
= """${
                [
                 tool('Ninja'),
                 [tool('CMake'), 'bin'].join(File.separator),
                 [tool('MSYS2'), 'mingw64', 'bin'].join(File.separator)
                ]
                .join(File.pathSeparator) +
                File.pathSeparator
            }$PATH"""

   
}
    stages
{
        stage
("build") {
            steps
{
                bat
'cmake -G Ninja .'
                bat
'cmake --build .'
           
}
       
}
   
}
}

Some of the tools are of CustomTool type and one is CMake (but I'm not using the CMake command, just a batch/shell step to call cmake manually, so I must add it to the path).  Some have the executable in a subdirectory of the automatically-installed tool archive, e.g. CMake has cmake.exe in the 'bin' subdirectory.

The multi-line groovy interpolated string produces a cross-platform path with semicolon (Windows) or colon (Linux/other) and slash/backslash as necessary.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d2b06b34-0744-43dd-849b-75839d454031%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline support for tools: CMake, custom tools

Joe Cavanaugh
Note - To make what Colin did work, you must be using declarative pipeline 1.2 or higher which has its own list of dependencies. I didn't realize this right away. 

On Monday, October 16, 2017 at 12:03:26 PM UTC-5, Colin Bennett wrote:
The workaround of use the 'tool' function in the environment PATH assignment is working for me.

Here is an example:

pipeline {
    agent
{ label "windows" }
    environment
{
        PATH
= """${
                [
                 tool('Ninja'),
                 [tool('CMake'), 'bin'].join(File.separator),
                 [tool('MSYS2'), 'mingw64', 'bin'].join(File.separator)
                ]
                .join(File.pathSeparator) +
                File.pathSeparator
            }$PATH"""

   
}
    stages
{
        stage
("build") {
            steps
{
                bat
'cmake -G Ninja .'
                bat
'cmake --build .'
           
}
       
}
   
}
}

Some of the tools are of CustomTool type and one is CMake (but I'm not using the CMake command, just a batch/shell step to call cmake manually, so I must add it to the path).  Some have the executable in a subdirectory of the automatically-installed tool archive, e.g. CMake has cmake.exe in the 'bin' subdirectory.

The multi-line groovy interpolated string produces a cross-platform path with semicolon (Windows) or colon (Linux/other) and slash/backslash as necessary.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b8abf5f8-b2e2-4acf-9333-4d18d29f2c74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.