Documentation on pipeline

1,261 views
Skip to first unread message

Jon Schewe

unread,
Sep 22, 2017, 10:25:38 PM9/22/17
to jenkinsci-users
I'm trying to switch to using the pipeline plugin and I'm having a really hard time finding documentation. In particular I want to call an ant build script and I don't want to do it with sh/bat because the OS may change.

I found some documentation at [1], however I get errors about missing properties when I try the example.

I found the withAnt block in the snippet generator, but can't find the syntax for inside the block.

It's not clear to me where I should put the node {} blocks either. I have seen that it's a good idea to do things on a node to ensure I know where it's running, but I'm not having a lot of luck getting the syntax right.

I'm also trying to limit which node the job runs on. I found [2] and tried using "node('fll-build')" and get errors:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 5: Undefined section "node" @ line 5, column 2.
   	node('fll-build') {	
    ^

You can see the current state of my experiments, and the history of what I've tried, at [3]

Mark Waite

unread,
Sep 22, 2017, 10:43:58 PM9/22/17
to jenkinsci-users
Based on the unit test, I believe the "withAnt" build wrapper assures that the selected ant tool is available on the agent where you're running, and configures the environment to use that version of ant.  It does not call ant.

Inside the withAnt() wrapper, you call ant using sh or bat as appropriate.

An example might be:

withAnt(installation: 'ant-latest', jdk: 'jdk8') {
    if (isUnix()) {
        sh 'ant clean build'
    } else {
        bat 'ant clean build'
    }
}

I've never used the withAnt task, but I use ant very often in my regression test branches.

I have a pipeline library (which looks badly out of date, since it doesn't use withAnt) that defines a build step for ant, and then I call it.  That build step hides the decision of which platform, and thus hides the decision to use "sh" or "bat" to invoke the ant command.

Now that we've both learned something new about withAnt, let's find a way to submit a pull request to jenkins.io to provide a withAnt() example.  Either that, or we can insert that documentation into the Ant plugin wiki page (to match what is done for the withMaven step)

Mark Waite

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALpcnoxq5f1_0dDxXYvYu9xxoErnrTd86Gtw1_C59pyt0M7CvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jon Schewe

unread,
Sep 23, 2017, 8:56:05 AM9/23/17
to Jenkins Users
Thank you for the pointers. Do you know how this documentation relates to calling ant then? To me it suggests that I don't need to write a function to determine the platform. 

Is there a central location for pipeline documentation or does it belong on each of the plugins?

Jon Schewe

unread,
Sep 23, 2017, 9:07:49 AM9/23/17
to Jenkins Users

Mark Waite

unread,
Sep 23, 2017, 9:08:43 AM9/23/17
to jenkins...@googlegroups.com
On Sat, Sep 23, 2017 at 6:56 AM Jon Schewe <jpsc...@mtu.net> wrote:
Thank you for the pointers. Do you know how this documentation relates to calling ant then? To me it suggests that I don't need to write a function to determine the platform. 


That's a good question.  I believe that documentation site (javaposse) is describing a specific Jenkins tool, "Job DSL", rather than Jenkins Pipeline.  Both are DSL's, and I believe that both use groovy as the base language for their work, but they are different DSL's, with different syntax details.
 
Is there a central location for pipeline documentation or does it belong on each of the plugins?


I believe the jenkins.io site is intended to be the central location for pipeline documentation.  

I think we can consider the withMaven documentation as an example when documenting withAnt.

There is a difference between the withAnt and withMaven, since the withMaven wrapper needs a separate pipeline maven plugin, while the withAnt wrapper seems to be delivered as part of the ant plugin.  I don't think that difference is especially significant for the documentation.

Mark Waite
 

Jon Schewe

unread,
Sep 23, 2017, 9:18:09 AM9/23/17
to jenkinsci-users
On Sat, Sep 23, 2017 at 8:08 AM, Mark Waite <mark.ea...@gmail.com> wrote:


On Sat, Sep 23, 2017 at 6:56 AM Jon Schewe <jpsc...@mtu.net> wrote:
Thank you for the pointers. Do you know how this documentation relates to calling ant then? To me it suggests that I don't need to write a function to determine the platform. 


That's a good question.  I believe that documentation site (javaposse) is describing a specific Jenkins tool, "Job DSL", rather than Jenkins Pipeline.  Both are DSL's, and I believe that both use groovy as the base language for their work, but they are different DSL's, with different syntax details.

Ahh, I see that now. I was so focused on the fact that it talked about a DSL with Jenkins for ant that I assumed it was the same DSL.
 
 
Is there a central location for pipeline documentation or does it belong on each of the plugins?


I believe the jenkins.io site is intended to be the central location for pipeline documentation.  

I think we can consider the withMaven documentation as an example when documenting withAnt.

There is a difference between the withAnt and withMaven, since the withMaven wrapper needs a separate pipeline maven plugin, while the withAnt wrapper seems to be delivered as part of the ant plugin.  I don't think that difference is especially significant for the documentation.

Well I don't have edit access to jenkins.io, so I've put in the ticket https://issues.jenkins-ci.org/browse/JENKINS-47076 so that the person with permissions can get it in.



Mark Waite
 
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFp%2Bg-Hw3iT-kqS7rYSUJhWNa4yLva1dy5SczTEypAoRw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Mark Waite

unread,
Sep 23, 2017, 9:36:02 AM9/23/17
to jenkins...@googlegroups.com
On Sat, Sep 23, 2017 at 7:18 AM Jon Schewe <jpsc...@mtu.net> wrote:
On Sat, Sep 23, 2017 at 8:08 AM, Mark Waite <mark.ea...@gmail.com> wrote:


On Sat, Sep 23, 2017 at 6:56 AM Jon Schewe <jpsc...@mtu.net> wrote:
Thank you for the pointers. Do you know how this documentation relates to calling ant then? To me it suggests that I don't need to write a function to determine the platform. 


That's a good question.  I believe that documentation site (javaposse) is describing a specific Jenkins tool, "Job DSL", rather than Jenkins Pipeline.  Both are DSL's, and I believe that both use groovy as the base language for their work, but they are different DSL's, with different syntax details.

Ahh, I see that now. I was so focused on the fact that it talked about a DSL with Jenkins for ant that I assumed it was the same DSL.
 
 
Is there a central location for pipeline documentation or does it belong on each of the plugins?


I believe the jenkins.io site is intended to be the central location for pipeline documentation.  

I think we can consider the withMaven documentation as an example when documenting withAnt.

There is a difference between the withAnt and withMaven, since the withMaven wrapper needs a separate pipeline maven plugin, while the withAnt wrapper seems to be delivered as part of the ant plugin.  I don't think that difference is especially significant for the documentation.

Well I don't have edit access to jenkins.io, so I've put in the ticket https://issues.jenkins-ci.org/browse/JENKINS-47076 so that the person with permissions can get it in.


I think we can contribute to jenkins.io, even without edit access.

We need to fork the jenkins.io github repository, make the proposed changes in a fork, submit a pull request.and rely on the maintainers of that site to review the pull request.

Mark Waite
 


Mark Waite
 

--
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 jenkinsci-use...@googlegroups.com.
--
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 jenkinsci-use...@googlegroups.com.

Daniel Beck

unread,
Sep 23, 2017, 9:45:33 AM9/23/17
to jenkins...@googlegroups.com

> On 23. Sep 2017, at 15:35, Mark Waite <mark.ea...@gmail.com> wrote:
>
> I think we can contribute to jenkins.io, even without edit access.

The notable exception being generated pages, like everything in https://jenkins.io/doc/pipeline/steps/ -- periodically generated directly from the running plugin.

The difference (generated/regular) is indicated by the lack of a "improve this page" link in the footer.

Jon Schewe

unread,
Sep 23, 2017, 9:53:41 AM9/23/17
to jenkinsci-users
I see that https://wiki.jenkins.io/display/JENKINS/Ant+Plugin is in fact a wiki and my bug reporting permissions give me access to edit it. So maybe we just edit the plugin page...
 


--
Reply all
Reply to author
Forward
0 new messages