Quantcast

How can i execute shell scripts from Jenkins ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How can i execute shell scripts from Jenkins ?

Kendiol
Hello everyone,

I'm a complete newbie to Jenkins.
I'm trying to get Jenkins to monitor the execution of my shell script
so i that i don't have to launch them manually each time but i can't
figure out how to do it.
I found out about the "monitor external job" option but i can't
configure it correctly.
I know that Jenkins can understand Shell script exit code so this is
what i did :

test1(){
ls /home/user1 | grep $2
case $? in
        0) msg_error 0 "Okay."
                ;;
        *) msg_error 2 "Error."
                ;;
esac
}


It's a simplified version of my functions.
I execute them manually but i want to launch them from Jenkins with
arguments and get the results of course.
Can this be done ?

Thanks.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How can i execute shell scripts from Jenkins ?

skidad
Create a Jenkins job, ( i created a free-style software project)
In the configuration of that job there is a "Build" section with "Add
build step" pulldown.
Add a "Execute Shell" step, and  insert your code.

Hope this helps!
Derek . . .

On Sep 27, 10:00 am, Kendiol <[hidden email]> wrote:

> Hello everyone,
>
> I'm a complete newbie to Jenkins.
> I'm trying to get Jenkins to monitor the execution of my shell script
> so i that i don't have to launch them manually each time but i can't
> figure out how to do it.
> I found out about the "monitor external job" option but i can't
> configure it correctly.
> I know that Jenkins can understand Shell script exit code so this is
> what i did :
>
> test1(){
> ls /home/user1 | grep $2
> case $? in
>         0) msg_error 0 "Okay."
>                 ;;
>         *) msg_error 2 "Error."
>                 ;;
> esac
>
> }
>
> It's a simplified version of my functions.
> I execute them manually but i want to launch them from Jenkins with
> arguments and get the results of course.
> Can this be done ?
>
> Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How can i execute shell scripts from Jenkins ?

HARDION Vincent
Hi,

Also you can define parametrized build.
These parameters will appear as env var.
More explanation here : https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build

Best regards,

Vincent

On 27 Sep 2011, at 22:19, Derek Brown wrote:

> Create a Jenkins job, ( i created a free-style software project)
> In the configuration of that job there is a "Build" section with "Add
> build step" pulldown.
> Add a "Execute Shell" step, and  insert your code.
>
> Hope this helps!
> Derek . . .
>
> On Sep 27, 10:00 am, Kendiol <[hidden email]> wrote:
>> Hello everyone,
>>
>> I'm a complete newbie to Jenkins.
>> I'm trying to get Jenkins to monitor the execution of my shell script
>> so i that i don't have to launch them manually each time but i can't
>> figure out how to do it.
>> I found out about the "monitor external job" option but i can't
>> configure it correctly.
>> I know that Jenkins can understand Shell script exit code so this is
>> what i did :
>>
>> test1(){
>> ls /home/user1 | grep $2
>> case $? in
>>         0) msg_error 0 "Okay."
>>                 ;;
>>         *) msg_error 2 "Error."
>>                 ;;
>> esac
>>
>> }
>>
>> It's a simplified version of my functions.
>> I execute them manually but i want to launch them from Jenkins with
>> arguments and get the results of course.
>> Can this be done ?
>>
>> Thanks.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How can i execute shell scripts from Jenkins ?

Kendiol
Thanks guys, so to execute my script I simply put ./myscript as the
command of the FreeStyle Build and i set the pamaeters to call my
functions.


On 28 sep, 07:36, Vincent Hardion <vincent.hard...@synchrotron-
soleil.fr> wrote:

> Hi,
>
> Also you can define parametrized build.
> These parameters will appear as env var.
> More explanation here :https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build
>
> Best regards,
>
> Vincent
>
> On 27 Sep 2011, at 22:19, Derek Brown wrote:
>
>
>
> > Create a Jenkins job, ( i created a free-style software project)
> > In the configuration of that job there is a "Build" section with "Add
> > build step" pulldown.
> > Add a "Execute Shell" step, and  insert your code.
>
> > Hope this helps!
> > Derek . . .
>
> > On Sep 27, 10:00 am, Kendiol <[hidden email]> wrote:
> >> Hello everyone,
>
> >> I'm a complete newbie to Jenkins.
> >> I'm trying to get Jenkins to monitor the execution of my shell script
> >> so i that i don't have to launch them manually each time but i can't
> >> figure out how to do it.
> >> I found out about the "monitor external job" option but i can't
> >> configure it correctly.
> >> I know that Jenkins can understand Shell script exit code so this is
> >> what i did :
>
> >> test1(){
> >> ls /home/user1 | grep $2
> >> case $? in
> >>         0) msg_error 0 "Okay."
> >>                 ;;
> >>         *) msg_error 2 "Error."
> >>                 ;;
> >> esac
>
> >> }
>
> >> It's a simplified version of my functions.
> >> I execute them manually but i want to launch them from Jenkins with
> >> arguments and get the results of course.
> >> Can this be done ?
>
> >> Thanks.- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -
Loading...