How to throw an error if a parameter is empty?

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

How to throw an error if a parameter is empty?

chencho m-a
Hi, 

I have some parameters and i would like to check if they are empty, and if so, dont start the build. 

Any clue?

Thank you

--
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/1c326abd-4cf2-44f3-9480-f1b9f85bcd70n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to throw an error if a parameter is empty?

Sinh Lam
You can try executing a basic script that exits 1 if the parameter is not defined (something like -z $parameter) as the first step in the build.  



 

On July 31, 2020 at 12:33:54 AM, chencho m-a ([hidden email]) wrote:

Hi, 

I have some parameters and i would like to check if they are empty, and if so, dont start the build. 

Any clue?

Thank you

--
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/1c326abd-4cf2-44f3-9480-f1b9f85bcd70n%40googlegroups.com.

--
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/CAJRbZWMCqzeO1OUuNfaY6kMY_MBNBm914T_%2BO8B0c3YuCes5Rg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to throw an error if a parameter is empty?

Haibinh Nguyen
In reply to this post by chencho m-a
Hi,
How about this:

env.FIELD1  = params.FIELD1
switch(FIELD1) {
    case "ABCD":
                env.p4 = '/usr/bin/p4'
                env.awk = 'awk'
     break
     case ""::
               currentBuild.result = 'SUCCESS'
               return
     break
}


On Fri, Jul 31, 2020 at 12:34 AM chencho m-a <[hidden email]> wrote:

>
> Hi,
>
> I have some parameters and i would like to check if they are empty, and if so, dont start the build.
>
> Any clue?
>
> Thank you
>
> --
> 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/1c326abd-4cf2-44f3-9480-f1b9f85bcd70n%40googlegroups.com.

--
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/CAN3%2Bw0Ac-%2Ba%2BgRfSaJ3krZ67P%2Bcw8urgPNhZ%2B4XoTNwb6agcfw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to throw an error if a parameter is empty?

jeremy mordkoff
@Haibinh is that a bash answer? 
@chencho -- are you looking for a solution in bash, or groovy? Declarative or scripted? 





On Friday, July 31, 2020 at 9:16:52 AM UTC-4, Haibinh Nguyen wrote:
Hi,
How about this:

env.FIELD1  = params.FIELD1
switch(FIELD1) {
    case "ABCD":
                env.p4 = '/usr/bin/p4'
                env.awk = 'awk'
     break
     case ""::
               currentBuild.result = 'SUCCESS'
               return
     break
}


On Fri, Jul 31, 2020 at 12:34 AM chencho m-a <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="SSBheF0FAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">chen...@...> wrote:

>
> Hi,
>
> I have some parameters and i would like to check if they are empty, and if so, dont start the build.
>
> Any clue?
>
> Thank you
>
> --
> 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="SSBheF0FAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/1c326abd-4cf2-44f3-9480-f1b9f85bcd70n%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/1c326abd-4cf2-44f3-9480-f1b9f85bcd70n%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/1c326abd-4cf2-44f3-9480-f1b9f85bcd70n%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/1c326abd-4cf2-44f3-9480-f1b9f85bcd70n%40googlegroups.com.

--
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/552471d5-c855-44ed-a952-ef515fee2702o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to throw an error if a parameter is empty?

chencho m-a
In reply to this post by Sinh Lam

What i want is that when you press the build button, a pop up or error at some point appears and stops the execution. 

I think that you need to overload the button in any way, but i dont know how to do it.

El viernes, 31 de julio de 2020 a las 15:47:53 UTC+2, [hidden email] escribió:
You can try executing a basic script that exits 1 if the parameter is not defined (something like -z $parameter) as the first step in the build.  



 

On July 31, 2020 at 12:33:54 AM, chencho m-a ([hidden email]) wrote:

Hi, 

I have some parameters and i would like to check if they are empty, and if so, dont start the build. 

Any clue?

Thank you

--
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].

--
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/2dd05e56-7f5b-4ccc-8270-a94a29ad31a1n%40googlegroups.com.