Just recently I stumbled upon a way to pass custom command line parameters to PDI jobs that are executed through kitchen. Somehow, this isn't documented in the user documentation , so I thought a few lines were in place.
According to the Pentaho documenation, kitchen supports the following series of command line parameters:
- file: xml file (job) to execute
- log: log file
- level: logging level (Nothing, Error, Minimal, Basic, ... Rowlevel)
- rep: repository name
- user: user to log in to repository
- pass: password to log in to repository
- listdir: list directories in repository
- listjobs: list repository jobs
- listrep: list available repositories
- norep: don't log into repository
- dir: set repository directory
- job: repository job to run
- export: file to export a job/trf too (including all related jobs/trf)
An undocumented parameter - at least it wasn't in any user documentation I was capable of finding - is the parameter called param, used to pass named parameters. E.g. you could specify the following when executing a job using kitchen:
sh kitchen.sh -file=/daily_run.kjb -level=Basic -param:AFFILIATE=affiliate01 -logfile=/daily_run.log
This would pass the value "affiliate01" to the variable AFFILIATE in the job "daily_run.kjb". For this to work the job needs to have the input parameter defined in the parameters tab of the job properties.
Simple as that.
Some links that could have brought you there:
- Kitchen user documentation
- Pentaho forum: "pass env variables into job via kitchen from cmd line"
- Matt's blog (--> where I found the mustard :-) )
- Jira by Sven Boden who actually asked for this feature