GIT - Run Git Command via QShell

<< Click to Display Table of Contents >>

Navigation:  IBM i Git IFS Commands >

GIT - Run Git Command via QShell

Description

This CL command can be used to run a single git command from a regular IBM i job. 

 

Command Example to perform git command in the IFS:

 

These 2 commands add all outstanding changed IFS files to the change list and commit to the git repository t /gitrepos/qgpl

 

 GIT GITREPODIR('/gitrepos/qgpl')           

     GITCMDPARM('add .')              

     SETPKGPATH(*YES)              

     DSPSTDOUT(*NO)                

     LOGSTDOUT(*NO)                

     PRTSTDOUT(*NO)                

     DLTSTDOUT(*YES)               

     IFSSTDOUT(*NO)                

     IFSFILE(' ')                  

     IFSOPT(*REPLACE)              

     CCSID(*SAME)                  

     PRTSPLF(GIT)                  

     PRTUSRDTA(*NONE)              

     PRTTXT(*NONE)                 

     PRTHOLD(*YES)                 

     PRTOUTQ(*SAME)                

 

 GIT GITREPODIR('/gitrepos/qgpl')           

     GITCMDPARM('commit -m "My cCommit"')              

     SETPKGPATH(*YES)              

     DSPSTDOUT(*NO)                

     LOGSTDOUT(*NO)                

     PRTSTDOUT(*NO)                

     DLTSTDOUT(*YES)               

     IFSSTDOUT(*NO)                

     IFSFILE(' ')                  

     IFSOPT(*REPLACE)              

     CCSID(*SAME)                  

     PRTSPLF(GIT)                  

     PRTUSRDTA(*NONE)              

     PRTTXT(*NONE)                 

     PRTHOLD(*YES)                 

     PRTOUTQ(*SAME)                

 

Parameters

 

Parameters

 

Stdout Logging Note: During execution, the CL command always creates a temporary outfile in library QTEMP that gets automatically populated with standard output (stdout) from the QSH/PASE command process that gets run. The temporary stdout output file name is: QTEMP/STDOUTQSH. If the file already exists for a subsequent run of the command, the QTEMP/STDOUTQSH temporary file is automatically cleared before running so each run gets a fresh copy of QTEMP/STDOUTQSH. The QTEMP/STDOUTQSH temp file gets created automatically always, even if none of the switches such as: DSPSTDOUT, LOGSTDOUT, PRTSTDOUT or IFSSTDOUT are specified.

 

GITREPODIR - Git repository directory. A valid git repository directory in the IFS.

 

GITCMDPARM - Any command line parameter that would usually be typed after the "git" command. The "git" part of the command line is implied.

 

SETPKGPATH - Add the IBM i Open Source Package path to PATH environment variable by calling QSHPATH command before running QSH/PASE commands. Default = *YES.

 

DSPSTDOUT - Display the outfile contents. Nice when debugging.

 

LOGSTDOUT - Place STDOUT log entries into the current jobs job log. Use this if you want the log info in the IBM i joblog. All STDOUT entries are written as CPF message: QSS9898

 

PRTSTDOUT - Print STDOUT to a spool file. Use this if you want a spool file of the log output.

 

DLTSTDOUT - This option insures that the STDOUT IFS temp files get cleaned up after processing. All IFS log files get created in the /tmp/qsh directory.

 

IFSSTDOUT - Copy std output to an IFS file. Nice for aggregating log results to a file.

 

IFSFILE - IFS file for stdout results. Needs to be specified if IFSSTDOUT = *YES.

 

IFSOPT - IFS file option. *REPLACE = replace stdout IFS file. *ADD = Add to stdout IFS file.

 

CCSID - When using the iToolkit component for command access, I originally had some issues with CL commands not working correctly. However I don't currently remember exactly why. This may have been solved, however I recommend still passing a value of 37 unless you are in a non US country. If you set to *SAME, the CCSID will stay the same as your current job with no change.

 

PRTSPLF - This option holds the name of the spool file used when PRTSTDOUT = *YES. It's a nice way to customize the stdout log prints. Default = GIT

 

PRTUSRDTA - This option holds the name of the spool file user data used when PRTSTDOUT = *YES. Default = *NONE

 

PRTTXT - This option holds the name of the spool file print txt to be used when PRTSTDOUT = *YES. Default = *NONE

 

PRTHOLD - This option determines if the spool file is held if one is generated when PRTSTDOUT = *YES. Default = *YES

 

PRTOUTQ - This option determines the output queue where the spool file will generated to when PRTSTDOUT = *YES. Default = *SAME