XlDeploy CLI run python file

294 views Asked by At

https://docs.xebialabs.com/xl-deploy/concept/getting-started-with-the-xl-deploy-cli.html

I am refering to this link. my cli is already configured and DEPLOYIT_CLI_HOME environment variable to the root directory where the CLI is installed.

say i am in folder d:\abc\ on windows command prompt

i execute the command on windows command prompt:

cli -username -password -f abc.py

File abc.py is at folder location d:\abc. When i run this it searches for abc.py in ext folder under DEPLOYIT_CLI_HOME path location?

1

There are 1 answers

0
Ibrahim Elshal On

When running scripts through XLDeploy CLI you have 2 options,

1- Passing full absolute path for the script to CLI as parameter.

2- Placing script in ext directory in which all content of ext directory is read upon CLI boot so that you can use any functions defined there .. this usually happens when you want to extend CLI, for more details check below as per this link extending the cli

You can extend the XL Deploy CLI by installing extensions that are loaded during CLI startup. Extensions are Python scripts, for example with Python class definitions, that will be available in commands or scripts run from the CLI. This feature can be combined with arguments given on the command line when starting up the CLI

so in your example it will not search in ext directory for your script abc.py you will need to pass full path to it or if script is placed in your ext directory you will not have to pass it as parameter to cli.cmd.

However it is recommended that you set the DEPLOYIT_CLI_HOME environment variable to the root directory where the CLI is installed as per this link set environment variables. CLI start script actually changes directory to DEPLOYIT_CLI_HOME before building the classpath and starting the CLI java process, irrespective of where you start the cli.cmd from.