Quantcast

Build step 'Execute Windows batch command' marked build as failure

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

Build step 'Execute Windows batch command' marked build as failure

barrett
Jenkins will randomly not execute batch files as part of the build.

In the failing case I get a message like :

18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2 
18:01:44  Build step 'Execute Windows batch command' marked build as failure

In the successful case I get 

11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0 
11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "& 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
11:40:53  
11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "& {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit $lastexitcode}"

It seems as though the powershell session is not able to be started? 
Any hints on this?


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

Re: Build step 'Execute Windows batch command' marked build as failure

Sami Tikka
This is just a wild guess because I do not use windows: Could it be Jenkins aborts the build when it sees the "exit 2" ?

For Linux and Mac versions of Jenkins it is a sign of failure when a build script exits with non-zero exit code.

-- Sami

bearrito <[hidden email]> kirjoitti 9.8.2012 kello 20.59:

Jenkins will randomly not execute batch files as part of the build.

In the failing case I get a message like :

18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2 
18:01:44  Build step 'Execute Windows batch command' marked build as failure

In the successful case I get 

11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0 
11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "& 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
11:40:53  
11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "& {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit $lastexitcode}"

It seems as though the powershell session is not able to be started? 
Any hints on this?


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

Re: Build step 'Execute Windows batch command' marked build as failure

barrett
That's absolutely the reason it is being marked as failure. Jenkins interprets non-zero codes as failure. The question is why it exits with 2 to begin with. 
The batch file is just wrapping a call to powershell but when it fails it appears to never even make the call to poweshell.


On Thu, Aug 9, 2012 at 5:49 PM, Sami Tikka <[hidden email]> wrote:
This is just a wild guess because I do not use windows: Could it be Jenkins aborts the build when it sees the "exit 2" ?

For Linux and Mac versions of Jenkins it is a sign of failure when a build script exits with non-zero exit code.

-- Sami

bearrito <[hidden email]> kirjoitti 9.8.2012 kello 20.59:

Jenkins will randomly not execute batch files as part of the build.

In the failing case I get a message like :

18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2 
18:01:44  Build step 'Execute Windows batch command' marked build as failure

In the successful case I get 

11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0 
11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "& 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
11:40:53  
11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "& {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit $lastexitcode}"

It seems as though the powershell session is not able to be started? 
Any hints on this?



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

Re: Build step 'Execute Windows batch command' marked build as failure

Scott Evans
Just a thought - are the successes and failures both running on the
same agent box?  If not, then perhaps one is configured differently
than the other.

Scott

On Thu, Aug 9, 2012 at 9:04 PM, j.barrett strausser
<[hidden email]> wrote:

> That's absolutely the reason it is being marked as failure. Jenkins
> interprets non-zero codes as failure. The question is why it exits with 2 to
> begin with.
> The batch file is just wrapping a call to powershell but when it fails it
> appears to never even make the call to poweshell.
>
>
> On Thu, Aug 9, 2012 at 5:49 PM, Sami Tikka <[hidden email]> wrote:
>>
>> This is just a wild guess because I do not use windows: Could it be
>> Jenkins aborts the build when it sees the "exit 2" ?
>>
>> For Linux and Mac versions of Jenkins it is a sign of failure when a build
>> script exits with non-zero exit code.
>>
>> -- Sami
>>
>> bearrito <[hidden email]> kirjoitti 9.8.2012 kello 20.59:
>>
>> Jenkins will randomly not execute batch files as part of the build.
>>
>> In the failing case I get a message like :
>>
>> 18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2
>> 18:01:44  Build step 'Execute Windows batch command' marked build as
>> failure
>>
>>
>> In the successful case I get
>>
>>
>> 11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0
>> 11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "&
>> 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
>> 11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call
>> C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
>> 11:40:53
>> 11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "&
>> {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit $lastexitcode}"
>>
>>
>> It seems as though the powershell session is not able to be started?
>>
>> Any hints on this?
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Build step 'Execute Windows batch command' marked build as failure

barrett
Same box. A failed build tends to be followed by a successful build. Hence, I was thinking making there is some resource contention taking place. 

Again from my log snippet I really feel there is an issue spawning the powershell session.

-barrett

On Thu, Aug 9, 2012 at 11:10 PM, Scott Evans <[hidden email]> wrote:
Just a thought - are the successes and failures both running on the
same agent box?  If not, then perhaps one is configured differently
than the other.

Scott

On Thu, Aug 9, 2012 at 9:04 PM, j.barrett strausser
<[hidden email]> wrote:
> That's absolutely the reason it is being marked as failure. Jenkins
> interprets non-zero codes as failure. The question is why it exits with 2 to
> begin with.
> The batch file is just wrapping a call to powershell but when it fails it
> appears to never even make the call to poweshell.
>
>
> On Thu, Aug 9, 2012 at 5:49 PM, Sami Tikka <[hidden email]> wrote:
>>
>> This is just a wild guess because I do not use windows: Could it be
>> Jenkins aborts the build when it sees the "exit 2" ?
>>
>> For Linux and Mac versions of Jenkins it is a sign of failure when a build
>> script exits with non-zero exit code.
>>
>> -- Sami
>>
>> bearrito <[hidden email]> kirjoitti 9.8.2012 kello 20.59:
>>
>> Jenkins will randomly not execute batch files as part of the build.
>>
>> In the failing case I get a message like :
>>
>> 18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2
>> 18:01:44  Build step 'Execute Windows batch command' marked build as
>> failure
>>
>>
>> In the successful case I get
>>
>>
>> 11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0
>> 11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "&
>> 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
>> 11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call
>> C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
>> 11:40:53
>> 11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "&
>> {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit $lastexitcode}"
>>
>>
>> It seems as though the powershell session is not able to be started?
>>
>> Any hints on this?
>>
>>
>>
>

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

Re: Build step 'Execute Windows batch command' marked build as failure

Scott Evans
Grasping at straws here late at night -

1. Do you have multiple builds running in separate agents at the same
time, or just one agent active?  Do you have anything else running
that might be using powershell at the same time?  I've not used it so
I don't know how it works if you try and spawn multiple powershell
sessions at the same time.

2. It looks like you're calling
C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1 in a successful
run.  Does that file/path exist in situations when it fails?  It seems
a bit odd that it's Job1\Job2 in the path, but perhaps that is as
intended.

3. Is there anything within the powershell script itself (script.ps1)
that might be returning an exit code of 2?  By default, from what
Google is telling me, powershell defaults to returning either 0
(success) or 1 (failure).  Unless I'm not finding accurate information
(which is entirely possible), I'm wondering if something else is
kicking it to a 2 exit code other than powershell itself.

-Scott


On Thu, Aug 9, 2012 at 10:21 PM, j.barrett strausser
<[hidden email]> wrote:

> Same box. A failed build tends to be followed by a successful build. Hence,
> I was thinking making there is some resource contention taking place.
>
> Again from my log snippet I really feel there is an issue spawning the
> powershell session.
>
> -barrett
>
> On Thu, Aug 9, 2012 at 11:10 PM, Scott Evans <[hidden email]> wrote:
>>
>> Just a thought - are the successes and failures both running on the
>> same agent box?  If not, then perhaps one is configured differently
>> than the other.
>>
>> Scott
>>
>> On Thu, Aug 9, 2012 at 9:04 PM, j.barrett strausser
>> <[hidden email]> wrote:
>> > That's absolutely the reason it is being marked as failure. Jenkins
>> > interprets non-zero codes as failure. The question is why it exits with
>> > 2 to
>> > begin with.
>> > The batch file is just wrapping a call to powershell but when it fails
>> > it
>> > appears to never even make the call to poweshell.
>> >
>> >
>> > On Thu, Aug 9, 2012 at 5:49 PM, Sami Tikka <[hidden email]> wrote:
>> >>
>> >> This is just a wild guess because I do not use windows: Could it be
>> >> Jenkins aborts the build when it sees the "exit 2" ?
>> >>
>> >> For Linux and Mac versions of Jenkins it is a sign of failure when a
>> >> build
>> >> script exits with non-zero exit code.
>> >>
>> >> -- Sami
>> >>
>> >> bearrito <[hidden email]> kirjoitti 9.8.2012 kello
>> >> 20.59:
>> >>
>> >> Jenkins will randomly not execute batch files as part of the build.
>> >>
>> >> In the failing case I get a message like :
>> >>
>> >> 18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2
>> >> 18:01:44  Build step 'Execute Windows batch command' marked build as
>> >> failure
>> >>
>> >>
>> >> In the successful case I get
>> >>
>> >>
>> >> 11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0
>> >> 11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "&
>> >> 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
>> >> 11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call
>> >> C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
>> >> 11:40:53
>> >> 11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "&
>> >> {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit
>> >> $lastexitcode}"
>> >>
>> >>
>> >> It seems as though the powershell session is not able to be started?
>> >>
>> >> Any hints on this?
>> >>
>> >>
>> >>
>> >
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Build step 'Execute Windows batch command' marked build as failure

barrett
1. There is a single executor running on the machine. There is no issue with multiple powershell sessions at the same time. It just creates a new powershell process.

2.That path exists even when the script fails. 

3. There isn't anything in the script that returns 2. The way that I structure my powershell is to catch an unhandled exceptions in the outermost catch I will set an exit code that is quite high, say 1500, I'll return this as last exit code.


-barrett

On Thu, Aug 9, 2012 at 11:48 PM, Scott Evans <[hidden email]> wrote:
Grasping at straws here late at night -

1. Do you have multiple builds running in separate agents at the same
time, or just one agent active?  Do you have anything else running
that might be using powershell at the same time?  I've not used it so
I don't know how it works if you try and spawn multiple powershell
sessions at the same time.

2. It looks like you're calling
C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1 in a successful
run.  Does that file/path exist in situations when it fails?  It seems
a bit odd that it's Job1\Job2 in the path, but perhaps that is as
intended.

3. Is there anything within the powershell script itself (script.ps1)
that might be returning an exit code of 2?  By default, from what
Google is telling me, powershell defaults to returning either 0
(success) or 1 (failure).  Unless I'm not finding accurate information
(which is entirely possible), I'm wondering if something else is
kicking it to a 2 exit code other than powershell itself.

-Scott


On Thu, Aug 9, 2012 at 10:21 PM, j.barrett strausser
<[hidden email]> wrote:
> Same box. A failed build tends to be followed by a successful build. Hence,
> I was thinking making there is some resource contention taking place.
>
> Again from my log snippet I really feel there is an issue spawning the
> powershell session.
>
> -barrett
>
> On Thu, Aug 9, 2012 at 11:10 PM, Scott Evans <[hidden email]> wrote:
>>
>> Just a thought - are the successes and failures both running on the
>> same agent box?  If not, then perhaps one is configured differently
>> than the other.
>>
>> Scott
>>
>> On Thu, Aug 9, 2012 at 9:04 PM, j.barrett strausser
>> <[hidden email]> wrote:
>> > That's absolutely the reason it is being marked as failure. Jenkins
>> > interprets non-zero codes as failure. The question is why it exits with
>> > 2 to
>> > begin with.
>> > The batch file is just wrapping a call to powershell but when it fails
>> > it
>> > appears to never even make the call to poweshell.
>> >
>> >
>> > On Thu, Aug 9, 2012 at 5:49 PM, Sami Tikka <[hidden email]> wrote:
>> >>
>> >> This is just a wild guess because I do not use windows: Could it be
>> >> Jenkins aborts the build when it sees the "exit 2" ?
>> >>
>> >> For Linux and Mac versions of Jenkins it is a sign of failure when a
>> >> build
>> >> script exits with non-zero exit code.
>> >>
>> >> -- Sami
>> >>
>> >> bearrito <[hidden email]> kirjoitti 9.8.2012 kello
>> >> 20.59:
>> >>
>> >> Jenkins will randomly not execute batch files as part of the build.
>> >>
>> >> In the failing case I get a message like :
>> >>
>> >> 18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2
>> >> 18:01:44  Build step 'Execute Windows batch command' marked build as
>> >> failure
>> >>
>> >>
>> >> In the successful case I get
>> >>
>> >>
>> >> 11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0
>> >> 11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "&
>> >> 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
>> >> 11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call
>> >> C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
>> >> 11:40:53
>> >> 11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "&
>> >> {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit
>> >> $lastexitcode}"
>> >>
>> >>
>> >> It seems as though the powershell session is not able to be started?
>> >>
>> >> Any hints on this?
>> >>
>> >>
>> >>
>> >
>
>

Loading...