User Tools

Site Tools


ibm_i_and_continuous_integration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ibm_i_and_continuous_integration [2017/03/18 09:49]
mihael [Create Unit Test Report]
ibm_i_and_continuous_integration [2017/05/25 19:20] (current)
mihael
Line 150: Line 150:
 fi fi
 </​sxh>​ </​sxh>​
 +
 +
 +== Tagging Build Objects ==
 +To identify from which source code revision the objects has been build we need to tag the objects with an identifier. The identifier could be the source code revision which can be retrieved from a git repository with the following line
 +
 +    git show -s --format=%h
 +
 +Output: ''​14b44a3''​
 +
 +To make sure that we only get the first 7 characters regardless of the output of the git command we can pipe the output to the ''​head''​ command like this
 +
 +    git show -s --format=%h | head -c 7
 +
 +QSYS objects can only store user information in two attributes:
 +
 +  * object description
 +  * user-defined attribute
 +
 +We will use the user-defined attribute though it can only hold 10 characters of information.
 +
 +The program //​UPDUSRATTR//​ available through the [[https://​github.com/​OSSILE/​OSSILE|OSSILE]] project can put this information on the object. We need to pass the following information as parameters:
 +
 +  * library name of the object
 +  * object name
 +  * object type (f. e. *PGM)
 +  * tag / user defined information (max. 10 characters)
 +
 +    CALL UPDUSRATTR PARM('​MSCHMIDT1'​ '​LLIST'​ '​*SRVPGM'​ '​GIT14b44a3'​)
 +
 +In the ''​setup''​ script it may look like this:
 +
 +    GIT_COMMIT_HASH=GIT$(git show -s --format=%h | head -c 7)
 +    system -kpieb "CALL MSCHMIDT1/​CIUPDOBJD PARM('​$TARGET_LIB'​ '​LLIST'​ '​*SRVPGM'​ '​$GIT_COMMIT_HASH'​)"​
  
  
Line 166: Line 199:
       exit 1        exit 1 
     fi     fi
 +
 +<note important>​It seems that the ILEUnit service program for stream file output is not report test failure and errors as expected. Errors (uncaught escape messages during the test) seems to break the test run. Failures (not matching asserts) are reported in the summary correctly but are not reported in the test case section for the test procedure. This renders unit testing with ILEUnit in Jenkins unusable.</​note>​
 +
  
 == Create Unit Test Report == == Create Unit Test Report ==
Line 174: Line 210:
 {{ :​ile_build_publish_unit_test.png?​nolink |}} {{ :​ile_build_publish_unit_test.png?​nolink |}}
  
 +
 +== Open Tasks ==
 +Jenkins provides a rich set of plugins. One of those plugins is the [[https://​wiki.jenkins-ci.org/​display/​JENKINS/​Task+Scanner+Plugin|Task Scanner Plugin]]. It is very flexible in identifying open tasks by keywords like //TODO// or //FIX ME//. The good thing is that it is also executed on the slave node so we can use it to scan the source code on the IBM i server.
 +
 +First we need to configure the keywords and the files to be scanned (in this case TODO and FIX ME as keywords and all files with the suffix //rpgle//).
 +
 +{{ :​ile_build_open_tasks_config.png?​nolink |}}
 +
 +The result of the scan looks like this:
 +
 +{{ :​ile_build_open_tasks_result.png?​nolink |}}
 +
 +
 +== Lint ==
 +In almost any programming languages exists a lint module which does some generic code checking. Of course there is no such thing for RPG but one could do some checking with a simple text search using regex.
 +
 +An example would be if there shouldn'​t be any ''​DSPLY''​ command in the source code (left over from some testing or debugging session). So you could use the following regex to identify such lines:
 +
 +    .*[dD][sS][pP][lL][yY].*
 +
 +There is the Text Finder plugin which can be configured with any regex and the option to mark the build ''​UNSTABLE''​ if such a line is found.
 +
 +{{ :​ile_build_text_finder.png?​nolink |}}
  
  
Line 179: Line 238:
   * building documenation (ILEDocs)   * building documenation (ILEDocs)
   * making save file from compiled objects   * making save file from compiled objects
-  * tagging objects with git and build id 
   * ftp save file to archive   * ftp save file to archive
  
ibm_i_and_continuous_integration.1489830561.txt.gz ยท Last modified: 2017/03/18 09:49 by mihael