Regarding Groovy scripting in pipeline

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

Regarding Groovy scripting in pipeline

Ranni S
Hi,

I'm new to groovy scripting and learning groovy and jenkins pipeline as code.
I'm new to this groovy community/support platform as well.
I'm not sure whether how relevant to post here.
Requesting for help and direction

I have a test/assignment as below.

Could any one kindly help with groovy skeleton code for the below use case.

1.       To build the java code and deploy the jar file to Nexus URL.

           a.       Assume all the Plugins are already present in the Jenkins.

           b.       Groovy skeletons such as mvn command calls, nexus publish call, etc., are expected.

            c.        Groovy Branching statements for deciding on whether to build or not needs to be
                       considered as below.

                                                           i.       Any *.java file under the src directory needs a new build.

                                                           ii.       Any pom.xml file changes needs a new build.

2.       To fetch only the updated GIT Repo Files and push it to Linux Host.

                       a.       Assume any pre-configured password ssh in Jenkins as you wish.

                       b.       Groovy skeletons such as usage of git command calls, authentication
                                  mechanisms, Linux push calls, etc., are expected.

3.       To Run Existing Jenkins Job & Pipeline.

                      a.       Assume 1 Jenkins Job and 1 Pipeline is already configured with the names of your
                                 choice.

                       b.       Groovy skeletons such as run command calls, run outcome based on Groovy
                                  Branching Statements, etc., are expected.

4.       To Backup, Deploy & Rollback in a Linux Host.

                        a.       Assume 1 custom Application & any backup location of your choice to back up
                                  the files which are going to be modified.

                         b.       Groovy skeletons such as run backup, deploy & rollback on deployment failure
                                    based branching logic, etc., are expected


Thanks
Ran
Reply | Threaded
Open this post in threaded view
|

Re: Regarding Groovy scripting in pipeline

Leo Gertsenshteyn
Hi Ran,

This mailing list is primarily for discussion of the development of the Groovy language itself rather than a general discussion list for things written *in* Groovy.

This sort of question would be better suited for posting to Stack Overflow.

Cheers,
Leo

On Thu, Oct 1, 2020, 1:34 AM Ranni S <[hidden email]> wrote:
Hi,

I'm new to groovy scripting and learning groovy and jenkins pipeline as code.
I'm new to this groovy community/support platform as well.
I'm not sure whether how relevant to post here.
Requesting for help and direction

I have a test/assignment as below.

Could any one kindly help with groovy skeleton code for the below use case.

1.       To build the java code and deploy the jar file to Nexus URL.

           a.       Assume all the Plugins are already present in the Jenkins.

           b.       Groovy skeletons such as mvn command calls, nexus publish call, etc., are expected.

            c.        Groovy Branching statements for deciding on whether to build or not needs to be
                       considered as below.

                                                           i.       Any *.java file under the src directory needs a new build.

                                                           ii.       Any pom.xml file changes needs a new build.

2.       To fetch only the updated GIT Repo Files and push it to Linux Host.

                       a.       Assume any pre-configured password ssh in Jenkins as you wish.

                       b.       Groovy skeletons such as usage of git command calls, authentication
                                  mechanisms, Linux push calls, etc., are expected.

3.       To Run Existing Jenkins Job & Pipeline.

                      a.       Assume 1 Jenkins Job and 1 Pipeline is already configured with the names of your
                                 choice.

                       b.       Groovy skeletons such as run command calls, run outcome based on Groovy
                                  Branching Statements, etc., are expected.

4.       To Backup, Deploy & Rollback in a Linux Host.

                        a.       Assume 1 custom Application & any backup location of your choice to back up
                                  the files which are going to be modified.

                         b.       Groovy skeletons such as run backup, deploy & rollback on deployment failure
                                    based branching logic, etc., are expected


Thanks
Ran
Reply | Threaded
Open this post in threaded view
|

Re: Regarding Groovy scripting in pipeline

paulk_asert
Administrator
There is also a "users" list which is more suitable, though some parts of your question require Jenkins knowledge which might best be suited elsewhere again.
For your question 1, I can suggest you look at using Gradle - similar to how the Groovy repo uses Gradle to build, test and release.
For your question 2, you could look in the groovy-release repo at the gradle scripts in there - they illustrate scripting git, svn, ssh and other things.

Cheers, Paul.


Virus-free. www.avast.com

On Fri, Oct 2, 2020 at 12:08 PM Leo Gertsenshteyn <[hidden email]> wrote:
Hi Ran,

This mailing list is primarily for discussion of the development of the Groovy language itself rather than a general discussion list for things written *in* Groovy.

This sort of question would be better suited for posting to Stack Overflow.

Cheers,
Leo

On Thu, Oct 1, 2020, 1:34 AM Ranni S <[hidden email]> wrote:
Hi,

I'm new to groovy scripting and learning groovy and jenkins pipeline as code.
I'm new to this groovy community/support platform as well.
I'm not sure whether how relevant to post here.
Requesting for help and direction

I have a test/assignment as below.

Could any one kindly help with groovy skeleton code for the below use case.

1.       To build the java code and deploy the jar file to Nexus URL.

           a.       Assume all the Plugins are already present in the Jenkins.

           b.       Groovy skeletons such as mvn command calls, nexus publish call, etc., are expected.

            c.        Groovy Branching statements for deciding on whether to build or not needs to be
                       considered as below.

                                                           i.       Any *.java file under the src directory needs a new build.

                                                           ii.       Any pom.xml file changes needs a new build.

2.       To fetch only the updated GIT Repo Files and push it to Linux Host.

                       a.       Assume any pre-configured password ssh in Jenkins as you wish.

                       b.       Groovy skeletons such as usage of git command calls, authentication
                                  mechanisms, Linux push calls, etc., are expected.

3.       To Run Existing Jenkins Job & Pipeline.

                      a.       Assume 1 Jenkins Job and 1 Pipeline is already configured with the names of your
                                 choice.

                       b.       Groovy skeletons such as run command calls, run outcome based on Groovy
                                  Branching Statements, etc., are expected.

4.       To Backup, Deploy & Rollback in a Linux Host.

                        a.       Assume 1 custom Application & any backup location of your choice to back up
                                  the files which are going to be modified.

                         b.       Groovy skeletons such as run backup, deploy & rollback on deployment failure
                                    based branching logic, etc., are expected


Thanks
Ran

Virus-free. www.avast.com