Best way to develop pipeline groovy

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

Best way to develop pipeline groovy

Christoph Ruepprich
I'm new to Jenkins and am learning how to write groovy scripts for pipelines. Right now I write my code in VS Code and copy & paste it into the Jenkins' project, save and build. This gets pretty tedious and time consuming. Is there a better way to develop scripts without having to either develop them in the web UI or copy & paste them?

Thanks!

--
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/a2f17740-5fec-4b9b-977c-df877bdf0fbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Best way to develop pipeline groovy

slide
There are two things that might make your life easier:

1) Jenkinsfile, you can put this into your source control and then it will be executed as if it were in the web ui. You just change the option in the job setup to "Pipeline script from SCM" instead of "Pipeline script". Then when you push updates to the Jenkinsfile, it will use your changes.
2) The Replay. This allows you to rerun a pipeline job and make small modifications to the script that was used to test things out, then you can incorporate those changes into your Jenkinsfile.

Hope those things help

Alex

On Tue, Oct 31, 2017 at 2:51 PM Christoph Ruepprich <[hidden email]> wrote:
I'm new to Jenkins and am learning how to write groovy scripts for pipelines. Right now I write my code in VS Code and copy & paste it into the Jenkins' project, save and build. This gets pretty tedious and time consuming. Is there a better way to develop scripts without having to either develop them in the web UI or copy & paste them?

Thanks!

--
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/a2f17740-5fec-4b9b-977c-df877bdf0fbc%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/CAPiUgVctE43BJvZhD5YobcquDkXaZW2Xt2dPdrbVy1%2BiOkxWaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Best way to develop pipeline groovy

Daniel Beck
In reply to this post by Christoph Ruepprich

> On 31. Oct 2017, at 22:51, Christoph Ruepprich <[hidden email]> wrote:
>
> This gets pretty tedious and time consuming. Is there a better way to develop scripts without having to either develop them in the web UI or copy & paste them?

https://jenkins.io/blog/2016/04/14/replay-with-pipeline might also help.

The declarative pipeline syntax also has a linter accessible from the Jenkins CLI, which should cut down on the trial & error executions:
https://jenkins.io/doc/book/pipeline/development/#linter

--
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/414FE298-83C0-47CC-B07A-0B58231BADEB%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Best way to develop pipeline groovy

Christoph Ruepprich
In reply to this post by slide
Thanks Alex,
I think the replay is probably the better option for me.

C

On Tuesday, 31 October 2017 17:05:14 UTC-5, slide wrote:
There are two things that might make your life easier:

1) Jenkinsfile, you can put this into your source control and then it will be executed as if it were in the web ui. You just change the option in the job setup to "Pipeline script from SCM" instead of "Pipeline script". Then when you push updates to the Jenkinsfile, it will use your changes.
2) The Replay. This allows you to rerun a pipeline job and make small modifications to the script that was used to test things out, then you can incorporate those changes into your Jenkinsfile.

Hope those things help

Alex

On Tue, Oct 31, 2017 at 2:51 PM Christoph Ruepprich <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="vvwCdgInAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cruep...@...> wrote:
I'm new to Jenkins and am learning how to write groovy scripts for pipelines. Right now I write my code in VS Code and copy & paste it into the Jenkins' project, save and build. This gets pretty tedious and time consuming. Is there a better way to develop scripts without having to either develop them in the web UI or copy & paste them?

Thanks!

--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="vvwCdgInAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/a2f17740-5fec-4b9b-977c-df877bdf0fbc%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/a2f17740-5fec-4b9b-977c-df877bdf0fbc%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/a2f17740-5fec-4b9b-977c-df877bdf0fbc%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/a2f17740-5fec-4b9b-977c-df877bdf0fbc%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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/6597d092-96dc-49a7-8710-7c8a148ccfd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Best way to develop pipeline groovy

Christoph Ruepprich
In reply to this post by Daniel Beck
Thanks Daniel,
when making changes in replay, is there a way to promote those changes to the actual script, or would I have to copy&paste them?

Will the Jenkins CLI work only for declarative pipeline syntax, or will scripts work, too?

Cheers,
C

On Wednesday, 1 November 2017 08:02:12 UTC-5, Daniel Beck wrote:

> On 31. Oct 2017, at 22:51, Christoph Ruepprich <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="k9mZ3vRXAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cruep...@...> wrote:
>
> This gets pretty tedious and time consuming. Is there a better way to develop scripts without having to either develop them in the web UI or copy & paste them?

<a href="https://jenkins.io/blog/2016/04/14/replay-with-pipeline" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fblog%2F2016%2F04%2F14%2Freplay-with-pipeline\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGPiSmtOPz6JQVn7Hkz642W7mjh_w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fblog%2F2016%2F04%2F14%2Freplay-with-pipeline\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGPiSmtOPz6JQVn7Hkz642W7mjh_w&#39;;return true;">https://jenkins.io/blog/2016/04/14/replay-with-pipeline might also help.

The declarative pipeline syntax also has a linter accessible from the Jenkins CLI, which should cut down on the trial & error executions:
<a href="https://jenkins.io/doc/book/pipeline/development/#linter" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fdoc%2Fbook%2Fpipeline%2Fdevelopment%2F%23linter\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEpEhtHN2jS-7dvshBtT86UoiVX8g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fdoc%2Fbook%2Fpipeline%2Fdevelopment%2F%23linter\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEpEhtHN2jS-7dvshBtT86UoiVX8g&#39;;return true;">https://jenkins.io/doc/book/pipeline/development/#linter

--
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/30c0e3a4-aece-4398-9351-fe21d0f886bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.