Thank you for the pointers. Do you know how this documentation <https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.step.StepContext.ant> 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? On Friday, September 22, 2017 at 9:43:58 PM UTC-5, Mark Waite wrote: > > Based on the unit test > <https://github.com/jenkinsci/ant-plugin/blob/798cf27ebba66685d2fa7446521228fae1ab975f/src/test/java/hudson/tasks/AntWrapperTest.java#L75>, > > 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 > <https://github.com/MarkEWaite/jenkins-pipeline-utils/blob/master/src/com/markwaite/Build.groovy> > (which > looks badly out of date, since it doesn't use withAnt) that defines a build > step for ant, and then I call it > <https://github.com/MarkEWaite/jenkins-bugs/blob/74db3aa963ba857d26b0b223a5aae2bdff4c727a/Jenkinsfile#L18>. > > 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 > <https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin>) > > Mark Waite > > On Fri, Sep 22, 2017 at 8:25 PM Jon Schewe <[email protected] <javascript:>> > wrote: > >> 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] >> >> 1 - >> https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.step.StepContext.ant >> 2 - >> https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#using-agents >> 3 - https://github.com/jpschewe/fll-sw/blob/jenkins-pipeline/Jenkinsfile >> >> -- >> http://mtu.net/~jpschewe >> >> -- >> 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 [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/CALpcnoxq5f1_0dDxXYvYu9xxoErnrTd86Gtw1_C59pyt0M7CvA%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/jenkinsci-users/CALpcnoxq5f1_0dDxXYvYu9xxoErnrTd86Gtw1_C59pyt0M7CvA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bd064708-b4e2-4d9d-bfbc-bc5fae3e7474%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
