ISISComputingGroup / IBEX

Top level repository for IBEX stories
5 stars 2 forks source link

GUI Build: Fail if copy fails #5128

Open DominicOram opened 4 years ago

DominicOram commented 4 years ago

As a developer I would like to know when IBEX_GUI fails to deploy to the share. This should be a failed build. When building release 6.0.0 I got the following output:

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>robocopy p:\Kits$\CompGroup\ICP\ibex_client_jre p:\Kits$\CompGroup\ICP\Releases\6.0.0\Client\Client\jre /MIR /R:1 /NFL /NDL /NP 

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : 27 January 2020 19:47:53
2020/01/27 19:47:53 ERROR 3 (0x00000003) Getting File System Type of Source p:\Kits$\CompGroup\ICP\ibex_client_jre\
The system cannot find the path specified.

2020/01/27 19:47:53 ERROR 3 (0x00000003) Getting File System Type of Destination p:\Kits$\CompGroup\ICP\Releases\6.0.0\Client\Client\jre\
The system cannot find the path specified.

   Source - p:\Kits$\CompGroup\ICP\ibex_client_jre\
     Dest - p:\Kits$\CompGroup\ICP\Releases\6.0.0\Client\Client\jre\

    Files : *.*

  Options : *.* /NDL /NFL /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /NP /R:1 /W:30 

------------------------------------------------------------------------------

2020/01/27 19:47:53 ERROR 3 (0x00000003) Accessing Source Directory p:\Kits$\CompGroup\ICP\ibex_client_jre\
The system cannot find the path specified.

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>if 0 GEQ 4 (

 exit /b 1 
) 

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>if not "YES" == "YES" (
if exist "" (rmdir "" )  
 mklink /J "" "p:\Kits$\CompGroup\ICP\Releases\6.0.0\Client" 
) 

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>REM Copy the install script across 

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>cd E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build\ 

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>copy /Y E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build\\install_client.bat p:\Kits$\CompGroup\ICP\Releases\6.0.0\Client 
The system cannot find the drive specified.

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>if 0 NEQ 0 (
 exit /b 0 
) 

Various copies have clearly failed but the errorlevel has remained at zero and so the build succeeded.

FreddieAkeroyd commented 4 years ago

Very wierd - logic looks OK in batch script i.e. errorlevel is not checked when nested. You could try:

setlocal enabledelayedexpansion

and then use !errorlevel! instead of %errorlevel% but that shouldn't make a difference. May be a robocopy issue, in which case all you could do is a separate "exists" block to check the directory

FreddieAkeroyd commented 4 years ago

robocopy help says

0×00   0       No errors occurred, and no copying was done.
                   The source and destination directory trees are completely synchronized. 

so if both source and destination do not exist so no copying is done, maybe it returns 0 ! So all we can do is a separate exists test on the directory

ChrisM-S commented 4 years ago

I notice that the line below in the log (which is a fallacy as logged) suggests to me that Robocopy might have returned a 4? (I'm not sure which side was substituted from errorlevel).

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>if 0 GEQ 4 (

 exit /b 1 
) 
DominicOram commented 4 years ago

I notice that the line below in the log (which is a fallacy as logged) suggests to me that Robocopy might have returned a 4? (I'm not sure which side was substituted from errorlevel).

E:\Jenkins\workspace\_releases_pipeline_Release_6.0.0\build>if 0 GEQ 4 (

 exit /b 1 
) 

No, it's the other side, we're checking if the errorlevel is greater than 4. So it is actually returning a 0, which is incorrect.