How to get a System Groovy Script in Git

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

How to get a System Groovy Script in Git

Amedee Van Gasse
Someone here at the company wrote a "System Groovy Script" that runs as a nightly job on master.
The code of the script, all 100 lines of it, is directly in the job configuration in the web interface.
I would like to get that code in a git repository, so that it's easy to roll back if needed, and also so that it is easier to read and write when I have the code open in IntelliJ.
What would be a "best practice" to do that?

I see that the Groovy plugin has only two options:
* code directly in the job config
* a groovy file, I assume somewhere in the job workspace, but that isn't specified.
Would I need another configuration before that? In "Source Code Management"?

How would you do it?

--
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/b5a6dc9d-0976-469c-8ae3-c17aaff05427n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to get a System Groovy Script in Git

Dirk Heinrichs-3
Am Montag, den 15.02.2021, 13:01 -0800 schrieb Amedee Van Gasse:

Would I need another configuration before that? In "Source Code Management"?

Yes. Just add the it repo containing your script there (as you would do in any other job) and change the System Groovy Script step to use the script from there.

HTH...

Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226 15966 18
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

--
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/e59a83c229c8847b5ee48101747f8163c30aabf3.camel%40opentext.com.

signature.asc (235 bytes) Download Attachment