User bio
404 bio not found
Member since May 31, 2017
Replies:

Hi Caza ,

We are facing the following issues :- 

1. We are getting the boolean value for the pass and fail unit test cases in cache Intersystem, but we are not able to assingn this boolean value into a variable in a batch script( r3 in this case)

2. @ECHO %FAILUREFLAG% is not giving any output to us, can you help with that also.

Please suggest us for the following problems or some alternative approach. The Batch script code is here :-

 

:: Switch output mode to utf8 - for comfortable log reading
@chcp 65001
@SET WORKSPACE="https://github.com/intersystems-ru/CacheGitHubCI.git"
:: Check the presence of the variable initialized by Jenkins
@IF NOT DEFINED WORKSPACE EXIT 1
@SET SUCCESSFLG =%CD%\successflag.txt
@SET FAILUREFLAG =%CD%\failureflag.txt
@ECHO %FAILUREFLAG%
@DEL "%SUCCESSFLG%"
@DEL "%FAILUREFLAG%"

:: The assembly may end with different results
:: Let the presence of a specific file in the directory tell us about the problems with the assembly
::% CD% - [C] urrent [D] irectory is a system variable
:: it contains the name of the directory in which the script is run (bat)
:: Delete the bad completion file from the previous start
::@DEL "% ERRFLAG%"

:::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::
:: CREATING CACHE CONTROL SCRIPT
:: line by line in the build.cos command to manage the Cache
:::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::

:: If the Cache is installed with normal or increased security
:: then in the first two lines the name and password of the user Cache
@ECHO user>build.cos
@ECHO password>>build.cos

:: Go to the necessary NAMESPACE
@ECHO zn "MYNAMESPACE" >>build.cos
@ECHO do ##class(Util.SourceControl).Init() >>build.cos
@ECHO zn "User" >>build.cos

@ECHO set ^^UnitTestRoot ="C:\test" >>build.cos

@ECHO do ##class(%%UnitTest.Manager).RunTest("myunittest","/nodelete")     >>build.cos
@Echo set i=$order(^^UnitTest.Result(""),-1) >>build.cos
@Echo  write  i >>build.cos
@Echo set unitResults=^^UnitTest.Result(i,"myunittest") >>build.cos
@ECHO Set r3  =  $LISTGET(unitResults,1,1) >>build.cos
@ECHO if r3'= 0 set file = "C:/unittests/successflag.txt" o file:("NWS") u file do $SYSTEM.OBJ.DisplayError(r3) >>build.cos
@ECHO if r3'= 1 set file = "C:/unittests/failureflag.txt" o file:("NWS") u file do $SYSTEM.OBJ.DisplayError(r3) >>build.cos
::@ECHO if 'r3 do $SYSTEM.Process.Terminate(,1)
::@ECHO halt
@IF EXIST "%FAILUREFLAG%" EXIT 1

::@ECHO  do ##class(%%UnitTest.Manager).RunTest("User") >>build.cos
::@ECHO set ut = do ##class(%%UnitTest.Manager).RunTest("User") >>build.cos
::set var = 1 >>build.coss
:: If it did not work out, we will show the error to see it in the logs of Jenkins
::@ECHO if ut'= 1 do $SYSTEM.OBJ.DisplayError(sc) >>build.cos
::echo %var%

@Echo On
@ECHO zn "%%SYS" >>build.cos
@ECHO set pVars("Namespace")="MYDEV" >>build.cos
@ECHO set pVars("SourceDir")="C:\source\MYNAMESPACE\src\cls\User" >>build.cos
@ECHO do ##class(User.Import).setup(.pVars)>>build.cos
:: Download and compile all the sources in the assembly directory;
::% WORKSPACE% - variable Jenkins
::@ECHO set sc = $SYSTEM.OBJ.ImportDir("%WORKSPACE%", "*. Xml", "ck",. Err, 1) >>build.cos

:: If it did not work out, we will show the error to see it in the logs of Jenkins
::@ECHO if sc'= 1 do $SYSTEM.OBJ.DisplayError(sc) >>build.cos

:: and from the cos script create an error flag file to notify the script bat
::@ECHO if sc'= 1 set file = "% ERRFLAG%" o file :( "NWS") u file do $ SYSTEM.OBJ.DisplayError (sc) with file >> build.cos

:: Finish the Cache process
::@ECHO if sc'= 1 set file = "% ERRFLAG%" o file :( "NWS") u file do $ SYSTEM.OBJ.DisplayError (sc) with file >> build.cos


:::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::
:: Call the Cache control program and pass the generated script to it ::
:::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::
C:\InterSystems\HealthShare\bin\cache.exe -s C:\InterSystems\HealthShare\mgr -U %%SYS <%CD%\build.cos


:: If the error file was created during the cos script execution - we notify Jenkins about this
::@IF EXIST "%ERRFLAG%" EXIT 1

Please tell us very clearly how to exit the cache terminal via command line and then that batch script should fail the jenkins job  ? Please tell us if it is feassible in intersystem . We have tried with all methods from intersystem doc library but still we could not progress (Jenkins job is not getting triggered based on boolean value passed from cache). Please suggest

Certifications & Credly badges:
Ankita has no Certifications & Credly badges yet.
Global Masters badges:
Ankita has no Global Masters badges yet.
Followers:
Ankita has no followers yet.
Following:
Ankita has not followed anybody yet.